<commit_before>module AutoHtmlFor

  # default options that can be overridden on the global level
  @@options = {
    :htmlized_attribute_suffix => '_html'
  }
  mattr_reader :options

  def self.included(base)
    base.extend(ClassMethods)
  end

  module ClassMethods
    def auto_html_for(raw_attrs, &proc)
      include AutoHtmlFor::InstanceMethods
      before_save :auto_html_prepare

      define_method("auto_html_prepare") do
        auto_html_methods = self.methods.select { |m| m=~/^auto_html_prepare_/ }
        auto_html_methods.each do |method|
          self.send(method)
        end
      end
      
      raw_attrs.each do |raw_attr|
        define_method("auto_html_prepare_#{raw_attr}") do
          self.send(raw_attr.to_s + AutoHtmlFor.options[:htmlized_attribute_suffix] + "=", 
            auto_html(self.send(raw_attr), &proc))
        end
      end
    end
  end<commit_msg>Attribute and Array attributes are now both supported as argument for auto_html_for method<commit_after>module AutoHtmlFor

  # default options that can be overridden on the global level
  @@options = {
    :htmlized_attribute_suffix => '_html'
  }
  mattr_reader :options

  def self.included(base)
    base.extend(ClassMethods)
  end

  module ClassMethods
    def auto_html_for(raw_attrs, &proc)
      include AutoHtmlFor::InstanceMethods
      before_save :auto_html_prepare

      define_method("auto_html_prepare") do
        auto_html_methods = self.methods.select { |m| m=~/^auto_html_prepare_/ }
        auto_html_methods.each do |method|
          self.send(method)
        end
      end
      
      [raw_attrs].flat.each do |raw_attr|
        define_method("auto_html_prepare_#{raw_attr}") do
          self.send(raw_attr.to_s + AutoHtmlFor.options[:htmlized_attribute_suffix] + "=", 
            auto_html(self.send(raw_attr), &proc))
        end
      end
    end
  end
{'fraction_non_alphanumeric': 0.08767268862911796, 'fraction_numerical': 0.0, 'mean_word_length': 2.9725738396624473, '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': '2840656', 'n_tokens_mistral': 602, 'n_tokens_neox': 583, 'n_words': 121}