Class: Cassanity::Increment
- Inherits:
-
Object
- Object
- Cassanity::Increment
- Defined in:
- lib/cassanity/increment.rb
Instance Attribute Summary collapse
-
#symbol ⇒ Object
readonly
Internal.
-
#value ⇒ Object
readonly
Internal.
Instance Method Summary collapse
- #eql?(other) ⇒ Boolean (also: #==)
-
#initialize(value = 1) ⇒ Increment
constructor
Public: Returns an increment instance.
Constructor Details
#initialize(value = 1) ⇒ Increment
Public: Returns an increment instance
14 15 16 17 18 19 |
# File 'lib/cassanity/increment.rb', line 14 def initialize(value = 1) raise ArgumentError.new("value cannot be nil") if value.nil? @symbol = :+ @value = value end |
Instance Attribute Details
#symbol ⇒ Object (readonly)
Internal
8 9 10 |
# File 'lib/cassanity/increment.rb', line 8 def symbol @symbol end |
#value ⇒ Object (readonly)
Internal
11 12 13 |
# File 'lib/cassanity/increment.rb', line 11 def value @value end |
Instance Method Details
#eql?(other) ⇒ Boolean Also known as: ==
21 22 23 |
# File 'lib/cassanity/increment.rb', line 21 def eql?(other) self.class.eql?(other.class) && value == other.value end |