Class: Activecube::Query::Selector::Operator

Inherits:
Object
  • Object
show all
Defined in:
lib/activecube/query/selector.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(operation, argument) ⇒ Operator

Returns a new instance of Operator.



11
12
13
14
# File 'lib/activecube/query/selector.rb', line 11

def initialize operation, argument
  @operation = operation
  @argument = argument
end

Instance Attribute Details

#argumentObject (readonly)

Returns the value of attribute argument.



9
10
11
# File 'lib/activecube/query/selector.rb', line 9

def argument
  @argument
end

#operationObject (readonly)

Returns the value of attribute operation.



9
10
11
# File 'lib/activecube/query/selector.rb', line 9

def operation
  @operation
end

Instance Method Details

#==(other) ⇒ Object



26
27
28
# File 'lib/activecube/query/selector.rb', line 26

def == other
  eql? other
end

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


20
21
22
23
24
# File 'lib/activecube/query/selector.rb', line 20

def eql?(other)
  return other.kind_of?(Operator) &&
      self.operation==other.operation &&
      self.argument == other.argument
end

#expression(_model, left, right) ⇒ Object



16
17
18
# File 'lib/activecube/query/selector.rb', line 16

def expression _model, left, right
  left.send(operation, right)
end

#hashObject



30
31
32
# File 'lib/activecube/query/selector.rb', line 30

def hash
  self.operation.hash + self.argument.hash
end