<commit_before>require "ule_page/version"
require 'rails'
require 'active_record'
require 'site_prism'

module UlePage
  autoload :Page, 'ule_page/page'
  autoload :Helper, 'ule_page/helper'
  autoload :ModelMatch, 'ule_page/model_match'
  autoload :SitePrismExtender, 'ule_page/site_prism_extender'

  autoload :Create, 'ule_page/models/create'
  autoload :Detail, 'ule_page/models/detail'
  autoload :Index, 'ule_page/models/index'


  mattr_accessor :resource_models
  @@resource_models = []

  mattr_accessor :special_maps
  @@special_maps = {}

  mattr_accessor :map
  @@map = {}

  mattr_accessor :map_initialized
  @@map_initialized = false

  def self.setup
    yield self
  end

  def self.add_models
    if(defined? ActiveRecord::Base && defined? Rails)
      @@resource_models = Dir["#{Rails.root}/app/models/**/*.rb"].map do |m|
        m.chomp('.rb').camelize.split("::").last
      end
    end
  end
end
<commit_msg>Include rails router and action number helper module to page base model<commit_after>require "ule_page/version"
require 'rails'
require 'active_record'
require 'site_prism'

module UlePage
  autoload :Page, 'ule_page/page'
  autoload :Helper, 'ule_page/helper'
  autoload :ModelMatch, 'ule_page/model_match'
  autoload :SitePrismExtender, 'ule_page/site_prism_extender'

  autoload :Create, 'ule_page/models/create'
  autoload :Detail, 'ule_page/models/detail'
  autoload :Index, 'ule_page/models/index'


  mattr_accessor :resource_models
  @@resource_models = []

  mattr_accessor :special_maps
  @@special_maps = {}

  mattr_accessor :map
  @@map = {}

  mattr_accessor :map_initialized
  @@map_initialized = false

  def self.setup
    UlePage::Page.send(:include, Rails.application.routes.url_helpers) if defined? Rails
    UlePage::Page.send(:include, ActionView::Helpers::NumberHelper) if defined? ActionView

    self.add_models

    yield self
  end

  def self.add_models
    if(defined? ActiveRecord::Base && defined? Rails)
      @@resource_models = Dir["#{Rails.root}/app/models/**/*.rb"].map do |m|
        m.chomp('.rb').camelize.split("::").last
      end
    end
  end
end



{'fraction_non_alphanumeric': 0.1234684260131951, 'fraction_numerical': 0.0, 'mean_word_length': 4.320802005012531, 'pattern_counts': {'":': 2, '<': 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': '1405065', 'n_tokens_mistral': 771, 'n_tokens_neox': 744, 'n_words': 150}