class Nullalign::Models
Constants
- IGNORE_DIRECTORY_REGEXP
- MODEL_DIRECTORY_REGEXP
Attributes
load_path[R]
Public Class Methods
new(load_path)
click to toggle source
# File lib/nullalign/models.rb, line 10 def initialize(load_path) @load_path = load_path end
Public Instance Methods
all()
click to toggle source
# File lib/nullalign/models.rb, line 26 def all ActiveRecord::Base.descendants.sort_by(&:name) end
dirs()
click to toggle source
# File lib/nullalign/models.rb, line 14 def dirs load_path.select { |lp| MODEL_DIRECTORY_REGEXP =~ lp.to_s unless IGNORE_DIRECTORY_REGEXP =~ lp.to_s} end
preload_all()
click to toggle source
# File lib/nullalign/models.rb, line 18 def preload_all self.dirs.each do |d| Dir.glob(File.join(d, "**", "*.rb")).each do |model_filename| Kernel.require_dependency model_filename end end end