Class: Orange::Middleware::Loader

Inherits:
Base show all
Defined in:
lib/orange-core/middleware/loader.rb

Instance Method Summary collapse

Methods inherited from Base

#call, #initialize, #inspect, #orange, #packet_call, #pass, #recapture

Constructor Details

This class inherits a constructor from Orange::Middleware::Base

Instance Method Details

#init(*args) ⇒ Object



4
5
6
7
8
9
10
11
12
13
# File 'lib/orange-core/middleware/loader.rb', line 4

def init(*args)
  unless Orange.autoloaded?
    Dir.glob(File.join(orange.app_dir, 'resources', '*.rb')).each do |f| 
      require f 
      orange.load Orange::Inflector.constantize(Orange::Inflector.camelize(File.basename(f, '.rb'))).new
    end
    Dir.glob(File.join(orange.app_dir, 'cartons', '*.rb')).each { |f|  require f }
    Dir.glob(File.join(orange.app_dir, 'middleware', '*.rb')).each { |f|  require f }
  end
end