<commit_before>module CucumberFactory
  module Switcher
    extend self

    def find_last(klass)
      # Don't use class.last, in sqlite that is not always the last inserted element
      if Rails::VERSION::MAJOR < 4
        klass.find(:last, :order => "id")
      else
        klass.order(:id).last
      end
    end

    def assign_attributes(model, attributes)
      if Rails::VERSION::MAJOR < 3 || (Rails::VERSION::MAJOR == 3 && Rails::VERSION::MINOR < 2)
        model.send(:attributes=, attributes, false) # ignore attr_accessible
      elsif Rails::VERSION::MAJOR < 4
        model.send(:assign_attributes, attributes, without_protection: true)
      else
        model.send(:assign_attributes, attributes)
      end
    end

  end
end<commit_msg>Restore 1.8.7 compatibility<commit_after>module CucumberFactory
  module Switcher
    extend self

    def find_last(klass)
      # Don't use class.last, in sqlite that is not always the last inserted element
      if Rails::VERSION::MAJOR < 4
        klass.find(:last, :order => "id")
      else
        klass.order(:id).last
      end
    end

    def assign_attributes(model, attributes)
      if Rails::VERSION::MAJOR < 3 || (Rails::VERSION::MAJOR == 3 && Rails::VERSION::MINOR < 2)
        model.send(:attributes=, attributes, false) # ignore attr_accessible
      elsif Rails::VERSION::MAJOR < 4
        model.send(:assign_attributes, attributes, :without_protection => true)
      else
        model.send(:assign_attributes, attributes)
      end
    end

  end
end
{'fraction_non_alphanumeric': 0.10609037328094302, 'fraction_numerical': 0.008513425016371971, 'mean_word_length': 2.9381443298969074, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 6, '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': '4206198', 'n_tokens_mistral': 472, 'n_tokens_neox': 446, 'n_words': 121}