Sha256: cbc9232cf56dc785f0cae3c98814b5e3f1cd00646894ca8a36f530ec1c7f1b72
Contents?: true
Size: 467 Bytes
Versions: 2
Compression:
Stored size: 467 Bytes
Contents
require 'orange-core/middleware/base' module Orange::Middleware class Globals < Base 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.options[k] = v} end def packet_call(packet) packet['orange.globals'] ||= orange.options pass packet end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
orange-core-0.7.1 | lib/orange-core/middleware/globals.rb |
orange-core-0.7.0 | lib/orange-core/middleware/globals.rb |