Class: RPath::Where
- Inherits:
-
VertexArrayExpression
- Object
- Expression
- VertexArrayExpression
- RPath::Where
- Defined in:
- lib/rpath/expressions.rb
Overview
Given a prior expression producing vertex array A, evaluates to an array containing the vertices in A that match certain conditions.
Instance Method Summary collapse
-
#initialize(prior, conditions = {}, &selector) ⇒ Where
constructor
A new instance of Where.
- #to_s ⇒ String
Methods inherited from VertexArrayExpression
#[], #method_missing, #named, #where
Methods inherited from Expression
Constructor Details
#initialize(prior, conditions) ⇒ Where #initialize(prior) {|vertex| ... } ⇒ Where
Returns a new instance of Where.
222 223 224 225 226 227 |
# File 'lib/rpath/expressions.rb', line 222 def initialize(prior, conditions = {}, &selector) super() @prior = prior @selector = block_given? ? selector : nil @conditions = block_given? ? nil : conditions end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class RPath::VertexArrayExpression
Instance Method Details
#to_s ⇒ String
230 231 232 233 234 235 236 |
# File 'lib/rpath/expressions.rb', line 230 def to_s conditions = @selector ? 'selector' : @conditions.map { |k, v| "#{k}: #{v}" }.join(', ') "#{@prior}[#{conditions}]" end |