Class: RPath::VertexExpression Abstract
- Inherits:
-
Expression
- Object
- Expression
- RPath::VertexExpression
- Defined in:
- lib/rpath/expressions.rb
Overview
This class is abstract.
An expression that evaluates to a vertex V
Instance Method Summary collapse
-
#[](subscript) ⇒ Attribute
Returns an expression that evaluates to the value of an attribute of V.
-
#adjacent ⇒ Adjacent
Returns an expression that evaluates to V’s adjacent vertices.
-
#content ⇒ Content
Returns an expression that evaluates to V’s content.
-
#method_missing(name, *args, &block) ⇒ Named
Returns an expression that evaluates to V’s adjacent vertices named
name.
Methods inherited from Expression
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Named
Returns an expression that evaluates to V’s adjacent vertices named name. Enables the basic RPath expression RPath { foo }.
78 79 80 |
# File 'lib/rpath/expressions.rb', line 78 def method_missing(name, *args, &block) Named.new adjacent, name.to_s end |
Instance Method Details
#[](subscript) ⇒ Attribute
Returns an expression that evaluates to the value of an attribute of V
68 69 70 71 72 73 |
# File 'lib/rpath/expressions.rb', line 68 def [](subscript) unless subscript.is_a?(String) || subscript.is_a?(Symbol) raise ArgumentError, "Subscript for expression producing a vertex must by a String or Symbol" end Attribute.new self, subscript end |
#adjacent ⇒ Adjacent
Returns an expression that evaluates to V’s adjacent vertices.
54 55 56 |
# File 'lib/rpath/expressions.rb', line 54 def adjacent Adjacent.new self end |
#content ⇒ Content
Returns an expression that evaluates to V’s content.
60 61 62 |
# File 'lib/rpath/expressions.rb', line 60 def content Content.new self end |