Class: JMESPath::Nodes::MultiSelectHash Private
- Defined in:
- lib/jmespath/nodes/multi_select_hash.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Defined Under Namespace
Classes: KeyValuePair
Instance Method Summary collapse
-
#initialize(kv_pairs) ⇒ MultiSelectHash
constructor
private
A new instance of MultiSelectHash.
- #optimize ⇒ Object private
- #visit(value) ⇒ Object private
Methods inherited from Node
Constructor Details
#initialize(kv_pairs) ⇒ MultiSelectHash
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.
Returns a new instance of MultiSelectHash.
6 7 8 |
# File 'lib/jmespath/nodes/multi_select_hash.rb', line 6 def initialize(kv_pairs) @kv_pairs = kv_pairs end |
Instance Method Details
#optimize ⇒ Object
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.
20 21 22 |
# File 'lib/jmespath/nodes/multi_select_hash.rb', line 20 def optimize self.class.new(@kv_pairs.map(&:optimize)) end |
#visit(value) ⇒ Object
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.
10 11 12 13 14 15 16 17 18 |
# File 'lib/jmespath/nodes/multi_select_hash.rb', line 10 def visit(value) if value.nil? nil else @kv_pairs.each_with_object({}) do |pair, hash| hash[pair.key] = pair.value.visit(value) end end end |