Class: Qonfig::DataSet
- Inherits:
-
Object
- Object
- Qonfig::DataSet
- Extended by:
- DSL
- Defined in:
- lib/qonfig/data_set.rb,
lib/qonfig/data_set/class_builder.rb
Overview
Defined Under Namespace
Modules: ClassBuilder
Instance Attribute Summary collapse
- #settings ⇒ Qonfig::Settings readonly private
Instance Method Summary collapse
- #[](key) ⇒ Object
- #clear! ⇒ void
- #configure(options_map = {}) ⇒ void
- #dig(*keys) ⇒ Object
- #freeze! ⇒ void
- #frozen? ⇒ void
-
#initialize(options_map = {}, &configurations) ⇒ DataSet
constructor
A new instance of DataSet.
- #reload!(options_map = {}, &configurations) ⇒ void
- #to_h ⇒ Hash (also: #to_hash)
Methods included from DSL
commands, compose, extended, load_from_env, load_from_self, load_from_yaml, setting
Constructor Details
#initialize(options_map = {}, &configurations) ⇒ DataSet
Returns a new instance of DataSet.
21 22 23 24 25 26 |
# File 'lib/qonfig/data_set.rb', line 21 def initialize( = {}, &configurations) @__access_lock__ = Mutex.new @__definition_lock__ = Mutex.new thread_safe_definition { load!(, &configurations) } end |
Instance Attribute Details
#settings ⇒ Qonfig::Settings (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
14 15 16 |
# File 'lib/qonfig/data_set.rb', line 14 def settings @settings end |
Instance Method Details
#[](key) ⇒ Object
85 86 87 |
# File 'lib/qonfig/data_set.rb', line 85 def [](key) thread_safe_access { settings[key] } end |
#clear! ⇒ void
This method returns an undefined value.
102 103 104 |
# File 'lib/qonfig/data_set.rb', line 102 def clear! thread_safe_access { settings.__clear__ } end |
#configure(options_map = {}) ⇒ void
This method returns an undefined value.
64 65 66 67 68 69 |
# File 'lib/qonfig/data_set.rb', line 64 def configure( = {}) thread_safe_access do settings.__apply_values__() yield(settings) if block_given? end end |
#dig(*keys) ⇒ Object
94 95 96 |
# File 'lib/qonfig/data_set.rb', line 94 def dig(*keys) thread_safe_access { settings.__dig__(*keys) } end |
#freeze! ⇒ void
This method returns an undefined value.
32 33 34 |
# File 'lib/qonfig/data_set.rb', line 32 def freeze! thread_safe_access { settings.__freeze__ } end |
#frozen? ⇒ void
This method returns an undefined value.
40 41 42 |
# File 'lib/qonfig/data_set.rb', line 40 def frozen? thread_safe_access { settings.__is_frozen__ } end |
#reload!(options_map = {}, &configurations) ⇒ void
This method returns an undefined value.
52 53 54 55 56 57 |
# File 'lib/qonfig/data_set.rb', line 52 def reload!( = {}, &configurations) thread_safe_definition do raise Qonfig::FrozenSettingsError, 'Frozen config can not be reloaded' if frozen? load!(, &configurations) end end |
#to_h ⇒ Hash Also known as: to_hash
75 76 77 |
# File 'lib/qonfig/data_set.rb', line 75 def to_h thread_safe_access { settings.__to_hash__ } end |