Class: Nucleon::Config::Options
- Inherits:
-
Object
- Object
- Nucleon::Config::Options
- Defined in:
- lib/core/config/options.rb
Constant Summary collapse
- @@options =
Property accessors / modifiers
{}
Class Method Summary collapse
-
.all ⇒ Object
—.
-
.clear(contexts) ⇒ Object
—.
-
.contexts(contexts = [], hierarchy = []) ⇒ Object
—.
-
.get(contexts, force = true) ⇒ Object
—.
-
.set(contexts, options, force = true) ⇒ Object
—.
Class Method Details
.all ⇒ Object
30 31 32 |
# File 'lib/core/config/options.rb', line 30 def self.all end |
.clear(contexts) ⇒ Object
66 67 68 69 70 71 72 73 |
# File 'lib/core/config/options.rb', line 66 def self.clear(contexts) unless contexts.is_a?(Array) contexts = [ contexts ] end contexts.each do |name| .delete(name.to_sym) end end |
.contexts(contexts = [], hierarchy = []) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/core/config/options.rb', line 13 def self.contexts(contexts = [], hierarchy = []) contexts = [ 'all', contexts ].flatten unless hierarchy.is_a?(Array) hierarchy = ( ! Util::Data.empty?(hierarchy) ? [ hierarchy ].flatten : [] ) end hierarchy.each do |group| group_contexts = Util::Data.prefix(group, contexts) contexts = [ contexts, group_contexts ].flatten end return contexts end |
.get(contexts, force = true) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/core/config/options.rb', line 36 def self.get(contexts, force = true) = {} unless contexts.is_a?(Array) contexts = ( ! Util::Data.empty?(contexts) ? [ contexts ].flatten : [] ) end contexts.each do |name| name = name.to_sym if .has_key?(name) = Util::Data.merge([ , [name] ], force) end end return end |
.set(contexts, options, force = true) ⇒ Object
53 54 55 56 57 58 59 60 61 62 |
# File 'lib/core/config/options.rb', line 53 def self.set(contexts, , force = true) unless contexts.is_a?(Array) contexts = ( ! Util::Data.empty?(contexts) ? [ contexts ].flatten : [] ) end contexts.each do |name| name = name.to_sym = ( .has_key?(name) ? [name] : {} ) [name] = Util::Data.merge([ , Config.symbol_map() ], force) end end |