<commit_before>module Schema
  module Compare
    class Comparison
      include Initializer

      Error = Class.new(RuntimeError)

      initializer :entries

      def self.build(control, compare, attr_names=nil)
        control_attributes = control.attributes
        compare_attributes = compare.attributes

        attr_names ||= control_attributes.keys

        entries = attr_names.map do |attr_name|
          build_entry(attr_name, control_attributes, compare_attributes)
        end

        new(entries)
      end

      def self.build_entry(attr_name, control_attributes, compare_attributes)
        control_value = control_attributes[attr_name]
        compare_value = compare_attributes[attr_name]

        entry = Entry.new(
          attr_name,
          control_value,
          attr_name,
          compare_value
        )

        entry
      end

      def entry(attr_name)
        entries.find do |entry|
          entry.control_attr_name == attr_name<commit_msg>Build entry receives both control and compare attribute names<commit_after>module Schema
  module Compare
    class Comparison
      include Initializer

      Error = Class.new(RuntimeError)

      initializer :entries

      def self.build(control, compare, attr_names=nil)
        control_attributes = control.attributes
        compare_attributes = compare.attributes

        attr_names ||= control_attributes.keys

        entries = attr_names.map do |attr_name|
          build_entry(attr_name, control_attributes, attr_name, compare_attributes)
        end

        new(entries)
      end

      def self.build_entry(control_attr_name, control_attributes, compare_attr_name, compare_attributes)
        control_value = control_attributes[control_attr_name]
        compare_value = compare_attributes[compare_attr_name]

        entry = Entry.new(
          control_attr_name,
          control_value,
          compare_attr_name,
          compare_value
        )

        entry
      end

      def entry(attr_name)
        entries.find do |entry|
          entry.control_attr_name == attr_name
{'fraction_non_alphanumeric': 0.05651340996168582, 'fraction_numerical': 0.0, 'mean_word_length': 2.4874791318864773, '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': '5311055', 'n_tokens_mistral': 557, 'n_tokens_neox': 532, 'n_words': 119}