Class: Neo4j::Cypher::Operand
- Inherits:
-
Object
- Object
- Neo4j::Cypher::Operand
- Defined in:
- lib/neo4j-cypher/operator.rb
Instance Attribute Summary collapse
-
#obj ⇒ Object
readonly
Returns the value of attribute obj.
Instance Method Summary collapse
-
#initialize(obj) ⇒ Operand
constructor
A new instance of Operand.
- #regexp? ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(obj) ⇒ Operand
Returns a new instance of Operand.
7 8 9 |
# File 'lib/neo4j-cypher/operator.rb', line 7 def initialize(obj) @obj = obj.respond_to?(:clause) ? obj.clause : obj end |
Instance Attribute Details
#obj ⇒ Object (readonly)
Returns the value of attribute obj.
5 6 7 |
# File 'lib/neo4j-cypher/operator.rb', line 5 def obj @obj end |
Instance Method Details
#regexp? ⇒ Boolean
11 12 13 |
# File 'lib/neo4j-cypher/operator.rb', line 11 def regexp? @obj.kind_of?(Regexp) end |
#to_s ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/neo4j-cypher/operator.rb', line 15 def to_s if @obj.is_a?(String) %Q["#{@obj}"] elsif @obj.is_a?(Operator) "(#{@obj.to_s})" elsif @obj.is_a?(MatchStart) "(#{@obj.to_cypher})" elsif @obj.respond_to?(:expr) && @obj.expr @obj.expr elsif @obj.respond_to?(:source) "'#{@obj.source}'" elsif @obj.respond_to?(:return_value) @obj.return_value.to_s else @obj.to_s end end |