Class: JSONP3::RelativeQueryExpression
- Inherits:
-
QueryExpression
- Object
- Expression
- QueryExpression
- JSONP3::RelativeQueryExpression
- Defined in:
- lib/json_p3/filter.rb
Overview
An embedded query starting at the current node.
Instance Attribute Summary
Attributes inherited from QueryExpression
Attributes inherited from Expression
Instance Method Summary collapse
Methods inherited from QueryExpression
Methods inherited from Expression
Constructor Details
This class inherits a constructor from JSONP3::QueryExpression
Instance Method Details
#evaluate(context) ⇒ Object
324 325 326 327 328 329 330 |
# File 'lib/json_p3/filter.rb', line 324 def evaluate(context) unless context.current.is_a?(Array) || context.current.is_a?(Hash) return @query.empty? ? context.current : JSONPathNodeList.new end @query.find(context.current) end |
#to_s ⇒ Object
332 333 334 |
# File 'lib/json_p3/filter.rb', line 332 def to_s "@#{@query.to_s[1..]}" end |