Class: Neo4j::Cypher::Property
- Inherits:
-
Object
- Object
- Neo4j::Cypher::Property
- Includes:
- Clause
- Defined in:
- lib/neo4j-cypher/property.rb
Overview
A property is returned from a Variable by using the [] operator.
It has a number of useful method like count
, sum
, avg
, min
, max
, collect
, head
, last
, tail
,
Defined Under Namespace
Classes: EvalContext
Constant Summary
Constants included from Clause
Instance Attribute Summary collapse
-
#prop_name ⇒ Object
Returns the value of attribute prop_name.
Attributes included from Clause
#clause_list, #clause_type, #eval_context, #insert_order
Instance Method Summary collapse
- #expr ⇒ Object
-
#initialize(var, prop_name = nil) ⇒ Property
constructor
A new instance of Property.
- #match_value ⇒ Object
- #return_value ⇒ Object
- #to_cypher ⇒ Object
- #to_function!(prop_name = nil) ⇒ Object
- #unary_operator(op, clause_type = :where, post_fix = nil) ⇒ Object
-
#var_name ⇒ Object
TODO check why needed.
Methods included from Clause
#<=>, #alias_name, #as_alias, #as_alias?, #clause_position, #create_clause_args_for, #match_value=, #prefix, #referenced!, #referenced?, #separator, #to_prop_string, #valid_clause?, #var_name=
Constructor Details
#initialize(var, prop_name = nil) ⇒ Property
Returns a new instance of Property.
17 18 19 20 21 |
# File 'lib/neo4j-cypher/property.rb', line 17 def initialize(var, prop_name = nil) super(var.clause_list, :property, EvalContext) @var = var @prop_name = prop_name end |
Instance Attribute Details
#prop_name ⇒ Object
Returns the value of attribute prop_name.
15 16 17 |
# File 'lib/neo4j-cypher/property.rb', line 15 def prop_name @prop_name end |
Instance Method Details
#expr ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/neo4j-cypher/property.rb', line 28 def expr if @function "#{@prop_name}(#{var_name})" else @prop_name ? "#{@var.var_name}.#{@prop_name}" : @var.var_name.to_s end end |
#match_value ⇒ Object
48 49 50 |
# File 'lib/neo4j-cypher/property.rb', line 48 def match_value @var.match_value end |
#return_value ⇒ Object
43 44 45 |
# File 'lib/neo4j-cypher/property.rb', line 43 def return_value to_cypher end |
#to_cypher ⇒ Object
58 59 60 |
# File 'lib/neo4j-cypher/property.rb', line 58 def to_cypher expr end |
#to_function!(prop_name = nil) ⇒ Object
37 38 39 40 41 |
# File 'lib/neo4j-cypher/property.rb', line 37 def to_function!(prop_name = nil) @prop_name = prop_name if prop_name @function = true eval_context end |
#unary_operator(op, clause_type = :where, post_fix = nil) ⇒ Object
52 53 54 55 |
# File 'lib/neo4j-cypher/property.rb', line 52 def unary_operator(op, clause_type = :where, post_fix = nil) # TODO DELETE THIS ? Operator.new(clause_list, self, nil, op, clause_type, post_fix).unary! end |
#var_name ⇒ Object
TODO check why needed
24 25 26 |
# File 'lib/neo4j-cypher/property.rb', line 24 def var_name @var.var_name end |