Class: Cassanity::Operator

Inherits:
Object
  • Object
show all
Defined in:
lib/cassanity/operator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(symbol, value) ⇒ Operator

Public: Returns an operator instance



14
15
16
17
# File 'lib/cassanity/operator.rb', line 14

def initialize(symbol, value)
  @symbol = symbol
  @value = value
end

Instance Attribute Details

#symbolObject (readonly)

Internal



8
9
10
# File 'lib/cassanity/operator.rb', line 8

def symbol
  @symbol
end

#valueObject (readonly)

Internal



11
12
13
# File 'lib/cassanity/operator.rb', line 11

def value
  @value
end

Instance Method Details

#eql?(other) ⇒ Boolean Also known as: ==



19
20
21
22
23
# File 'lib/cassanity/operator.rb', line 19

def eql?(other)
  self.class.eql?(other.class) &&
    value == other.value &&
    symbol == other.symbol
end

#inspectObject

Public



28
29
30
31
32
33
34
# File 'lib/cassanity/operator.rb', line 28

def inspect
  attributes = [
    "symbol=#{symbol.inspect}",
    "value=#{value.inspect}",
  ]
  "#<#{self.class.name}:#{object_id} #{attributes.join(', ')}>"
end