Module: Serega::Config::ConfigInstanceMethods
Instance Attribute Summary collapse
-
#opts ⇒ Hash
readonly
Current config data.
Instance Method Summary collapse
-
#[](name) ⇒ Object
Get config option, delegates to opts#[].
-
#[]=(name) ⇒ Object
Set config option, delegates to opts#[]=.
-
#fetch(name) ⇒ Object
Fetch config option, delegates to opts#fetch.
-
#initialize(opts = {}) ⇒ Object
Initializes new config instance and deeply duplicates all provided options to remove possibility of accidental overwriting of parent/nested configs.
Instance Attribute Details
#opts ⇒ Hash (readonly)
Returns Current config data.
14 15 16 |
# File 'lib/serega/config.rb', line 14 def opts @opts end |
Instance Method Details
#[](name) ⇒ Object
Get config option, delegates to opts#[]
42 |
# File 'lib/serega/config.rb', line 42 def_delegators :opts, :[], :[]=, :fetch, :keys, :has_key? |
#[]=(name) ⇒ Object
Set config option, delegates to opts#[]=
42 |
# File 'lib/serega/config.rb', line 42 def_delegators :opts, :[], :[]=, :fetch, :keys, :has_key? |
#fetch(name) ⇒ Object
Fetch config option, delegates to opts#fetch
42 |
# File 'lib/serega/config.rb', line 42 def_delegators :opts, :[], :[]=, :fetch, :keys, :has_key? |
#initialize(opts = {}) ⇒ Object
Initializes new config instance and deeply duplicates all provided options to remove possibility of accidental overwriting of parent/nested configs.
22 23 24 |
# File 'lib/serega/config.rb', line 22 def initialize(opts = {}) @opts = Utils::EnumDeepDup.call(opts) end |