Class: JSONPath::Nodes::IndexNode
- Defined in:
- lib/jsonpath/nodes.rb
Instance Method Summary collapse
Methods inherited from PathNode
#recurse, #traverse, #traversing_descendants?
Instance Method Details
#descend(*objects) ⇒ Object
104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/jsonpath/nodes.rb', line 104 def descend(*objects) offset = Integer(index.text_value) results = [] traverse(objects) do |obj| if obj.is_a?(Array) if obj.size > offset results << obj[offset] end end end results end |