<commit_before>require 'lappen'
require 'rails/railtie'

module Lappen
  module Scope
    def pipeline(params = {})
      pipeline = Lappen::Pipeline.find(self)
      pipeline.perform(self, params)
    end
  end

  class Railtie < Rails::Railtie
    initializer 'lappen.setup_active_record' do |app|
      ActiveSupport.on_load(:active_record) do
        begin
          ::ApplicationRecord.extend(Lappen::Scope)
        rescue NameError
          extend Lappen::Scope
        end
      end
    end
  end
end<commit_msg>Fix lappen/scope for Rails 5<commit_after>require 'lappen'
require 'rails/railtie'

module Lappen
  module Scope
    def pipeline(params = {})
      pipeline = Lappen::Pipeline.find(self)
      pipeline.perform(self, params)
    end
  end

  class Railtie < Rails::Railtie
    config.to_prepare do
      begin
        ApplicationRecord.extend(Lappen::Scope)
      rescue NameError
        ActiveRecord::Base.extend(Lappen::Scope)
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.08597748208802457, 'fraction_numerical': 0.0010235414534288639, 'mean_word_length': 2.8203125, 'pattern_counts': {'":': 0, '<': 5, '<?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': '1313458', 'n_tokens_mistral': 307, 'n_tokens_neox': 311, 'n_words': 69}