Class: Janeway::Interpreters::WildcardSelectorDeleter

Inherits:
WildcardSelectorInterpreter show all
Defined in:
lib/janeway/interpreters/wildcard_selector_deleter.rb

Overview

Interprets a wildcard selector, and deletes the results.

Constant Summary

Constants inherited from Base

Base::NOTHING

Instance Attribute Summary

Attributes inherited from Base

#next, #node

Instance Method Summary collapse

Methods inherited from WildcardSelectorInterpreter

#interpret_array, #interpret_hash

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

Delete all elements from the input



16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/janeway/interpreters/wildcard_selector_deleter.rb', line 16

def interpret(input, _parent, _root, _path)
  case input
  when Array
    results = input.dup
    input.clear
    results
  when Hash
    results = input.values
    input.clear
    results
  else
    []
  end
end