Class: Orange::Middleware::Globals
- Defined in:
- lib/orange-core/middleware/globals.rb
Instance Method Summary collapse
Methods inherited from Base
#call, #initialize, #inspect, #orange, #pass, #recapture
Constructor Details
This class inherits a constructor from Orange::Middleware::Base
Instance Method Details
#init(opts = {}) ⇒ Object
5 6 7 8 9 10 |
# File 'lib/orange-core/middleware/globals.rb', line 5 def init(opts = {}) opts = opts.with_defaults(:file => "__ORANGE__/config.yml") @file = opts[:file].gsub('__ORANGE__', orange.app_dir) @globals = orange[:parser].yaml(@file) || {} @globals.each{|k,v| orange.[k] = v} end |
#packet_call(packet) ⇒ Object
12 13 14 15 |
# File 'lib/orange-core/middleware/globals.rb', line 12 def packet_call(packet) packet['orange.globals'] ||= orange. pass packet end |