Class: Janeway::Interpreters::CurrentNodeInterpreter
- Defined in:
- lib/janeway/interpreters/current_node_interpreter.rb
Overview
Interpets current node identifier. This applies the following selector to the input.
Constant Summary
Constants inherited from Base
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#interpret(input, parent, root, _path) ⇒ Array
Apply selector to each value in the current node and return result.
Methods inherited from Base
#as_json, #initialize, #selector, #to_s, #type
Constructor Details
This class inherits a constructor from Janeway::Interpreters::Base
Instance Method Details
#interpret(input, parent, root, _path) ⇒ Array
Apply selector to each value in the current node and return result.
The result is an Array containing all results of evaluating the CurrentNode’s selector (if any.)
If the selector extracted values from nodes such as strings, numbers or nil/null, these will be included in the array. If the selector did not match any node, the array may be empty. If there was no selector, then the current input node is returned in the array.
26 27 28 29 30 31 32 |
# File 'lib/janeway/interpreters/current_node_interpreter.rb', line 26 def interpret(input, parent, root, _path) if @next @next.interpret(input, parent, root, []) else input end end |