Class: Musterb::HashExtractor
- Inherits:
-
Object
- Object
- Musterb::HashExtractor
- Defined in:
- lib/musterb/hash_extractor.rb
Instance Attribute Summary collapse
-
#parent ⇒ Object
readonly
Returns the value of attribute parent.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #[](symbol) ⇒ Object
-
#initialize(value, parent) ⇒ HashExtractor
constructor
A new instance of HashExtractor.
Constructor Details
#initialize(value, parent) ⇒ HashExtractor
Returns a new instance of HashExtractor.
6 7 8 9 |
# File 'lib/musterb/hash_extractor.rb', line 6 def initialize(value, parent) @value = to_string_access(value) @parent = parent end |
Instance Attribute Details
#parent ⇒ Object (readonly)
Returns the value of attribute parent.
4 5 6 |
# File 'lib/musterb/hash_extractor.rb', line 4 def parent @parent end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
4 5 6 |
# File 'lib/musterb/hash_extractor.rb', line 4 def value @value end |
Instance Method Details
#[](symbol) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/musterb/hash_extractor.rb', line 11 def [](symbol) if @value.has_key? symbol @value[symbol] else @parent[symbol] end end |