<commit_before>require 'erb'

module Tadpole
  module SectionProviders
    class ERBProvider < SectionProvider
      EXTENSIONS = ['.erb']
      
      def initialize(full_path, owner)
        super

        erb = ERB.new(content, nil, '<>')
        instance_eval(<<-eof, full_path, -1)
          def render(locals = nil)
            eval(locals.map {|k,v| "\#{k} = \#{v.inspect}" }.join(';'), binding) if locals
            #{erb.src} 
          end
        eof
      end
    end
  end
end<commit_msg>Hack support for ERB and locals (FIXME: make more efficient)<commit_after>require 'erb'

module Tadpole
  module SectionProviders
    class ERBProvider < SectionProvider
      EXTENSIONS = ['.erb']
      
      def initialize(full_path, owner)
        super

        erb = ERB.new(content, nil, '<>')
        instance_eval(<<-eof, full_path, -1)
          def render(locals = nil)
            eval(locals.map {|k,v| "\#{k} = \#{v.inspect}" }.join(';'), binding) if locals
            instance_eval #{erb.src.inspect}
          end
        eof
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.1287313432835821, 'fraction_numerical': 0.0018656716417910447, 'mean_word_length': 2.056980056980057, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 5, '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': '2857702', 'n_tokens_mistral': 367, 'n_tokens_neox': 359, 'n_words': 87}