<commit_before>module BettyResource
  class Record
    attr_reader :model

    def initialize(args)
      @model = args[:model]
      model.properties.each do |property|
        define_singleton_method("#{property.name}=") do |val|
          attributes[property.name] = val
        end
      end
    end

    def attributes
      @attributes ||= model.properties.inject(HashWithIndifferentAccess.new()) do |hash, property|
        hash.merge(property.name => nil)
      end
    end
  end
end
<commit_msg>Move definition of set method to new method<commit_after>module BettyResource
  class Record
    attr_reader :model

    def initialize(args)
      @model = args[:model]
      model.properties.each do |property|
        define_setter(property)
      end
    end

    def attributes
      @attributes ||= model.properties.inject(HashWithIndifferentAccess.new()) do |hash, property|
        hash.merge(property.name => nil)
      end
    end

    private

    def define_setter(property)
      define_singleton_method("#{property.name}=") do |val|
        attributes[property.name] = val
      end
    end
  end
end

{'fraction_non_alphanumeric': 0.09302325581395349, 'fraction_numerical': 0.0, 'mean_word_length': 2.6930693069306932, 'pattern_counts': {'":': 0, '<': 3, '<?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': '4642620', 'n_tokens_mistral': 325, 'n_tokens_neox': 316, 'n_words': 80}