Class: Graphoid::Operation
- Inherits:
-
Object
- Object
- Graphoid::Operation
- Defined in:
- lib/graphoid/queries/operation.rb
Instance Attribute Summary collapse
-
#operand ⇒ Object
readonly
Returns the value of attribute operand.
-
#operator ⇒ Object
readonly
Returns the value of attribute operator.
-
#scope ⇒ Object
readonly
Returns the value of attribute scope.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(scope, key, value) ⇒ Operation
constructor
A new instance of Operation.
- #resolve ⇒ Object
Constructor Details
#initialize(scope, key, value) ⇒ Operation
Returns a new instance of Operation.
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/graphoid/queries/operation.rb', line 7 def initialize(scope, key, value) @scope = scope @operator = nil @operand = key @value = value match = key.match(/^(.+)_(.+)$/) @operand, @operator = match[1..2] if match @operand = build_operand(@scope, @operand) || @operand end |
Instance Attribute Details
#operand ⇒ Object (readonly)
Returns the value of attribute operand.
5 6 7 |
# File 'lib/graphoid/queries/operation.rb', line 5 def operand @operand end |
#operator ⇒ Object (readonly)
Returns the value of attribute operator.
5 6 7 |
# File 'lib/graphoid/queries/operation.rb', line 5 def operator @operator end |
#scope ⇒ Object (readonly)
Returns the value of attribute scope.
5 6 7 |
# File 'lib/graphoid/queries/operation.rb', line 5 def scope @scope end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
5 6 7 |
# File 'lib/graphoid/queries/operation.rb', line 5 def value @value end |
Instance Method Details
#resolve ⇒ Object
18 19 20 |
# File 'lib/graphoid/queries/operation.rb', line 18 def resolve @operand.resolve(self) end |