<commit_before>module Core
  class Article
    include ActiveModel::Validations

    attr_accessor :id, :url, :title, :description, :body

    validates_presence_of :id, :url, :title, :description, :body
    validates_url :url

    private :id=

    def initialize(id, attributes = {})
      self.id = id

      attributes && attributes.each do |name, value|
        send("#{name}=", value)
      end
    end
  end
end<commit_msg>Coerce Article attributes on initialisation<commit_after>module Core
  class Article
    include ActiveModel::Validations

    attr_accessor :id, :url, :title, :description, :body

    validates_presence_of :id, :url, :title, :description, :body
    validates_url :url

    private :id=

    def initialize(id, attributes = {})
      self.id = id

      Array(attributes).each do |name, value|
        send("#{name}=", value)
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.11098527746319366, 'fraction_numerical': 0.0, 'mean_word_length': 3.1116279069767443, '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': '5497593', 'n_tokens_mistral': 278, 'n_tokens_neox': 270, 'n_words': 78}