Class: PyrRules::Engine

Inherits:
Rails::Engine
  • Object
show all
Defined in:
lib/pyr_rules/engine.rb

Instance Method Summary collapse

Instance Method Details

#load_extensionsObject



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/pyr_rules/engine.rb', line 43

def load_extensions
  puts "\n--- Loading lib/pyr_rules for #{self.class.name} "
  Dir.glob("#{self.root}/lib/#{self.class.name.underscore.split("/")[0]}/extensions/**/*.rb").sort.each do |entry|
    
    puts "Reloading extension: #{entry}"
    require_dependency "#{entry}"
  end

  # Dir.glob("#{self.root}/lib/#{self.class.name.split('::').first}/**/*.rb").sort.each do |entry|
  #   next if entry.end_with?("version.rb") || entry.end_with?("engine.rb")
  #   puts "Reloading lib: #{entry}"
  #   require_dependency "#{entry}"
  # end

  Dir.glob("#{self.root}/app/models/pyr_rules/**/*.rb").sort.each do |entry|
    next if entry.end_with? "version.rb"
    puts "Reloading models: #{entry}"
    require_dependency "#{entry}"
  end

  Dir.glob("#{self.root}/app/rules/pyr_rules/**/*.rb").sort.each do |entry|
    next if entry.end_with? "version.rb"
    puts "Reloading rules: #{entry}"
    require_dependency "#{entry}"
  end
  puts "--- Loaded lib/pyr_rules for #{self.class.name} \n"
end