<commit_before>module Prezzo
  module Explainable
    def self.included(base)
      base.class_eval do
        base.extend(ClassMethods)
      end
    end

    module ClassMethods
      def explain_with(*options)
        define_method(:explain) do
          explanation = {}

          options.each do |method|
            explanation[method] = send(method)
          end

          explanation
        end
      end
    end
  end
end<commit_msg>refactor: Use each_with_object instead of appending to hash<commit_after>module Prezzo
  module Explainable
    def self.included(base)
      base.class_eval do
        base.extend(ClassMethods)
      end
    end

    module ClassMethods
      def explain_with(*options)
        define_method(:explain) do
          options.each_with_object({}) do |method, explanation|
            explanation[method] = send(method)
          end
        end
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.06222707423580786, 'fraction_numerical': 0.0, 'mean_word_length': 2.046511627906977, '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': '5737888', 'n_tokens_mistral': 259, 'n_tokens_neox': 254, 'n_words': 65}