Class: Enumpath::Operator::Wildcard
- Defined in:
- lib/enumpath/operator/wildcard.rb
Overview
Implements JSONPath wildcard operator syntax. See README for syntax and examples
Constant Summary collapse
- OPERATOR =
'*'
Instance Attribute Summary
Attributes inherited from Base
Class Method Summary collapse
-
.detect?(operator) ⇒ true, false
Simple test of whether the operator matches the OPERATOR constant.
Instance Method Summary collapse
-
#apply(remaining_path, enum, resolved_path) {|remaining_path, enum, resolved_path| ... } ⇒ Object
Yields to the block once for every direct member of the enumerable.
Methods inherited from Base
Constructor Details
This class inherits a constructor from Enumpath::Operator::Base
Class Method Details
Instance Method Details
#apply(remaining_path, enum, resolved_path) {|remaining_path, enum, resolved_path| ... } ⇒ Object
Yields to the block once for every direct member of the enumerable
26 27 28 29 30 |
# File 'lib/enumpath/operator/wildcard.rb', line 26 def apply(remaining_path, enum, resolved_path) keys = keys(enum) Enumpath.log('Applying wildcard to keys') { { keys: keys } } keys.each { |key| yield([key.to_s] + remaining_path, enum, resolved_path) } end |