<commit_before>module Clearwater
  module CachedRender
    def self.included base
      %x{
        Opal.defn(base, 'type', 'Thunk');
        Opal.defn(base, 'render', function(prev) {
          var self = this;
          var should_render;

          if(prev && prev.vnode && #{!should_render?(`prev`)}) {
            return prev.vnode;
          } else {
            return #{sanitize_content(render)};
          }
        });
      }
    end

    def should_render? _
      false
    end
  end
end<commit_msg>Define methods on self rather than base<commit_after>module Clearwater
  module CachedRender
    def self.included base
      %x{
        Opal.defn(self, 'type', 'Thunk');
        Opal.defn(self, 'render', function(prev) {
          var self = this;
          var should_render;

          if(prev && prev.vnode && #{!should_render?(`prev`)}) {
            return prev.vnode;
          } else {
            return #{sanitize_content(render)};
          }
        });
      }
    end

    def should_render? _
      false
    end
  end
end
{'fraction_non_alphanumeric': 0.11619047619047619, 'fraction_numerical': 0.0, 'mean_word_length': 1.7585301837270342, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3288709', 'n_tokens_mistral': 326, 'n_tokens_neox': 320, 'n_words': 73}