Class: Neo4j::Core::Cypher::RelVar
- Inherits:
-
Object
- Object
- Neo4j::Core::Cypher::RelVar
- Includes:
- Variable
- Defined in:
- lib/neo4j-core/cypher/cypher.rb
Overview
represent an unbound relationship variable used in match,where,return statement
Instance Attribute Summary collapse
-
#expr ⇒ Object
readonly
Returns the value of attribute expr.
-
#expressions ⇒ Object
readonly
Returns the value of attribute expressions.
-
#var_name ⇒ Object
readonly
Returns the value of attribute var_name.
Attributes included from Variable
Instance Method Summary collapse
- #[](p) ⇒ Object
-
#initialize(expressions, variables, expr) ⇒ RelVar
constructor
A new instance of RelVar.
- #rel_type ⇒ Object
-
#to_s ⇒ String
A cypher string for this relationship variable.
Methods included from Variable
#as, #count, #distinct, #exist?, #is_a?, #neo_id, #property?
Constructor Details
#initialize(expressions, variables, expr) ⇒ RelVar
Returns a new instance of RelVar.
839 840 841 842 843 844 845 846 |
# File 'lib/neo4j-core/cypher/cypher.rb', line 839 def initialize(expressions, variables, expr) variables << self @expr = expr @expressions = expressions guess = expr ? /([[:alpha:]_]*)/.match(expr)[1] : "" @auto_var_name = "v#{variables.size}" @var_name = guess.empty? ? @auto_var_name : guess end |
Instance Attribute Details
#expr ⇒ Object (readonly)
Returns the value of attribute expr.
837 838 839 |
# File 'lib/neo4j-core/cypher/cypher.rb', line 837 def expr @expr end |
#expressions ⇒ Object (readonly)
Returns the value of attribute expressions.
837 838 839 |
# File 'lib/neo4j-core/cypher/cypher.rb', line 837 def expressions @expressions end |
#var_name ⇒ Object (readonly)
Returns the value of attribute var_name.
837 838 839 |
# File 'lib/neo4j-core/cypher/cypher.rb', line 837 def var_name @var_name end |
Instance Method Details
#[](p) ⇒ Object
852 853 854 855 856 857 858 |
# File 'lib/neo4j-core/cypher/cypher.rb', line 852 def [](p) if @expr.to_s[0..0] == ':' @var_name = @auto_var_name @expr = "#{@var_name}#{@expr}" end super end |
#rel_type ⇒ Object
848 849 850 |
# File 'lib/neo4j-core/cypher/cypher.rb', line 848 def rel_type Property.new(@expressions, self, 'type').to_function! end |
#to_s ⇒ String
Returns a cypher string for this relationship variable.
861 862 863 |
# File 'lib/neo4j-core/cypher/cypher.rb', line 861 def to_s var_name end |