Module: Musterb::ExtractValues
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.new_context(value, old_context = Musterb::NullExtractor.new) ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/musterb/extract_values.rb', line 14 def self.new_context(value, old_context = Musterb::NullExtractor.new) case value when Hash Musterb::HashExtractor.new(value, old_context) when nil Musterb::NullExtractor.new(old_context) else Musterb::ObjectExtractor.new(value, old_context) end end |
Instance Method Details
#[](symbol) ⇒ Object
6 7 8 |
# File 'lib/musterb/extract_values.rb', line 6 def [](symbol) @context[symbol] end |
#chain(symbol) ⇒ Object
10 11 12 |
# File 'lib/musterb/extract_values.rb', line 10 def chain(symbol) Musterb::Chain.new self[symbol] end |
#value ⇒ Object
2 3 4 |
# File 'lib/musterb/extract_values.rb', line 2 def value @context.value end |