Class: Config
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#default ⇒ Object
readonly
Returns the value of attribute default.
-
#runtime ⇒ Object
readonly
Returns the value of attribute runtime.
Instance Method Summary collapse
- #[](key) ⇒ Object
- #[]=(key, value) ⇒ Object
- #include?(key) ⇒ Boolean
-
#initialize(runtime, config, default) ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize(runtime, config, default) ⇒ Config
Returns a new instance of Config.
4 5 6 |
# File 'lib/RubyExt/Config.rb', line 4 def initialize runtime, config, default @runtime, @config, @default = runtime, config, default end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
2 3 4 |
# File 'lib/RubyExt/Config.rb', line 2 def config @config end |
#default ⇒ Object (readonly)
Returns the value of attribute default.
2 3 4 |
# File 'lib/RubyExt/Config.rb', line 2 def default @default end |
#runtime ⇒ Object (readonly)
Returns the value of attribute runtime.
2 3 4 |
# File 'lib/RubyExt/Config.rb', line 2 def runtime @runtime end |
Instance Method Details
#[](key) ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/RubyExt/Config.rb', line 8 def [] key value = @runtime[key] value = @config[key] if value.equal? nil value = @default[key] if value.equal? nil raise "There is no key #{key}!" if value.equal? nil return value end |
#[]=(key, value) ⇒ Object
16 17 18 |
# File 'lib/RubyExt/Config.rb', line 16 def []= key, value @runtime[key] = value end |
#include?(key) ⇒ Boolean
20 21 22 |
# File 'lib/RubyExt/Config.rb', line 20 def include? key (@runtime[key] != nil) or (@config[key] != nil) or (@default[key] != nil) end |