<commit_before>module I18n
  module Alchemy
    # If you wanna override the Assign Attributes from ActiveRecord you can include 
    # this module. 
    #
    # Maybe rename this methods to #alchemy_assign_attributes=
    #
    module Attributes
      # Allows you to set all the attributes for a particular mass-assignment
      # security role by passing in a hash of attributes with keys matching
      # the attribute names (which again matches the column names) and the role
      # name using the :as option.
      #
      # To bypass mass-assignment security you can use the :without_protection => true
      # option.
      #      
      def assign_attributes(attributes, options={})
        attributes = sanitize_for_mass_assignment(attributes, self.send(:mass_assignment_role)) unless options[:without_protection]
        attributes.each do |key, value|
          if self.respond_to?("#{key}=")
            self.localized.send("#{key}=", value) # Just all of this, for this line! Do you have a better idea? I'm tired :\
          else
            raise(::ActiveRecord::UnknownAttributeError, "unknown attribute: #{key}")
          end
        end
      end
    end
  end
end<commit_msg>Put some comments in i18n_alchemy/attributes.rb<commit_after>module I18n
  module Alchemy
    # If you wanna override the Assign Attributes from ActiveRecord you can include 
    # this module. 
    #
    # Maybe rename this methods to #alchemy_assign_attributes= is a better idea
    #
    module Attributes
      # Allows you to set all the attributes for a particular mass-assignment
      # security role by passing in a hash of attributes with keys matching
      # the attribute names (which again matches the column names) and the role
      # name using the :as option.
      #
      # To bypass mass-assignment security you can use the :without_protection => true
      # option.
      #      
      # TODO: Handle multi parameters attributes
      #
      def assign_attributes(attributes, options={})
        attributes = sanitize_for_mass_assignment(attributes, self.send(:mass_assignment_role)) unless options[:without_protection]
        attributes.each do |key, value|
          if self.respond_to?("#{key}=")
            self.localized.send("#{key}=", value) # Just all of this, for this line! Do you have a better idea? I'm tired :\
          else
            raise(::ActiveRecord::UnknownAttributeError, "unknown attribute: #{key}")
          end
        end
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.0748, 'fraction_numerical': 0.0024, 'mean_word_length': 2.6887905604719764, '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': '6413709', 'n_tokens_mistral': 668, 'n_tokens_neox': 649, 'n_words': 252}