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.
5 6 7 8 9 10 11 12 13 14 |
# File 'lib/graphoid/queries/operation.rb', line 5 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.
3 4 5 |
# File 'lib/graphoid/queries/operation.rb', line 3 def operand @operand end |
#operator ⇒ Object (readonly)
Returns the value of attribute operator.
3 4 5 |
# File 'lib/graphoid/queries/operation.rb', line 3 def operator @operator end |
#scope ⇒ Object (readonly)
Returns the value of attribute scope.
3 4 5 |
# File 'lib/graphoid/queries/operation.rb', line 3 def scope @scope end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
3 4 5 |
# File 'lib/graphoid/queries/operation.rb', line 3 def value @value end |
Instance Method Details
#resolve ⇒ Object
16 17 18 |
# File 'lib/graphoid/queries/operation.rb', line 16 def resolve @operand.resolve(self) end |