Class: Cassanity::Operator
- Inherits:
-
Object
- Object
- Cassanity::Operator
- Defined in:
- lib/cassanity/operator.rb
Direct Known Subclasses
Addition, Decrement, Increment, Cassanity::Operators::Eq, Cassanity::Operators::Gt, Cassanity::Operators::Gte, Cassanity::Operators::Lt, Cassanity::Operators::Lte, Removal
Instance Attribute Summary collapse
-
#symbol ⇒ Object
readonly
Internal.
-
#value ⇒ Object
readonly
Internal.
Instance Method Summary collapse
- #eql?(other) ⇒ Boolean (also: #==)
-
#initialize(symbol, value) ⇒ Operator
constructor
Public: Returns an operator instance.
-
#inspect ⇒ Object
Public.
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
#symbol ⇒ Object (readonly)
Internal
8 9 10 |
# File 'lib/cassanity/operator.rb', line 8 def symbol @symbol end |
#value ⇒ Object (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 |
#inspect ⇒ Object
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 |