<commit_before>module KPI
  class Report
    extend KPI::Report::SuppressMemoization
    extend ActiveSupport::Memoizable
 
    include KPI::Report::DynamicDefinitions
    
    blacklist :initialize, :collect!, :entries, :time, :title, :defined_kpis
 
    def initialize(*args)
      options = args.extract_options!
      @time = options[:time] || Time.now
    end
    attr_reader :time
 
    def collect!
      self.class.defined_kpis.each {|kpi_method| send(kpi_method) }
      self
    end
 
    def entries
      Enumerator.new do |yielder|
        self.class.defined_kpis.each do |kpi_method|
          result = send(kpi_method)
          yielder.yield(Entry.new(*result))
        end
      end
    end
 
    def title
      self.class.name
    end
 
    def defined_kpis
      self.class.defined_kpis
    end
  end
end<commit_msg>Refactoring Report#collect!<commit_after>module KPI
  class Report
    extend KPI::Report::SuppressMemoization
    extend ActiveSupport::Memoizable
 
    include KPI::Report::DynamicDefinitions
    
    blacklist :initialize, :collect!, :entries, :time, :title, :defined_kpis
 
    def initialize(*args)
      options = args.extract_options!
      @time = options[:time] || Time.now
    end
    attr_reader :time
 
    def collect!
      self.defined_kpis.each {|kpi_method| send(kpi_method) }
      self
    end
 
    def entries
      Enumerator.new do |yielder|
        self.class.defined_kpis.each do |kpi_method|
          result = send(kpi_method)
          yielder.yield(Entry.new(*result))
        end
      end
    end
 
    def title
      self.class.name
    end
 
    def defined_kpis
      self.class.defined_kpis
    end
  end
end
{'fraction_non_alphanumeric': 0.08630952380952381, 'fraction_numerical': 0.0, 'mean_word_length': 2.465979381443299, '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': '4704829', 'n_tokens_mistral': 553, 'n_tokens_neox': 520, 'n_words': 116}