Class: JSONP3::Path::RelativeQueryExpression
- Inherits:
-
QueryExpression
- Object
- Expression
- QueryExpression
- JSONP3::Path::RelativeQueryExpression
- Defined in:
- lib/json_p3/path/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::Path::QueryExpression
Instance Method Details
#evaluate(context) ⇒ Object
326 327 328 329 330 331 332 |
# File 'lib/json_p3/path/filter.rb', line 326 def evaluate(context) unless context.current.is_a?(Array) || context.current.is_a?(Hash) return @query.empty? ? context.current : NodeList.new end @query.find(context.current) end |
#to_s ⇒ Object
334 335 336 |
# File 'lib/json_p3/path/filter.rb', line 334 def to_s "@#{@query.to_s[1..]}" end |