Class: Janeway::Interpreters::NameSelectorDeleter
- Inherits:
-
NameSelectorInterpreter
- Object
- Base
- NameSelectorInterpreter
- Janeway::Interpreters::NameSelectorDeleter
- Defined in:
- lib/janeway/interpreters/name_selector_deleter.rb
Overview
Interprets a name selector, and deletes the matched values.
Constant Summary
Constants inherited from Base
Instance Attribute Summary
Attributes inherited from NameSelectorInterpreter
Attributes inherited from Base
Instance Method Summary collapse
-
#as_json ⇒ Hash
Return hash representation of this interpreter.
-
#interpret(input, _parent, _root, _path) ⇒ Object
Interpret selector on the given input.
Methods inherited from NameSelectorInterpreter
Methods inherited from Base
#initialize, #selector, #to_s, #type
Constructor Details
This class inherits a constructor from Janeway::Interpreters::NameSelectorInterpreter
Instance Method Details
#as_json ⇒ Hash
Return hash representation of this interpreter
22 23 24 |
# File 'lib/janeway/interpreters/name_selector_deleter.rb', line 22 def as_json { type: type, value: name, next: @next&.as_json } end |
#interpret(input, _parent, _root, _path) ⇒ Object
Interpret selector on the given input.
14 15 16 17 18 |
# File 'lib/janeway/interpreters/name_selector_deleter.rb', line 14 def interpret(input, _parent, _root, _path) return [] unless input.is_a?(Hash) && input.key?(name) [input.delete(name)] end |