Class: Cassanity::Decrement

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value = 1) ⇒ Decrement

Public: Returns an decrement instance

Raises:

  • (ArgumentError)


14
15
16
17
18
19
# File 'lib/cassanity/decrement.rb', line 14

def initialize(value = 1)
  raise ArgumentError.new("value cannot be nil") if value.nil?

  @symbol = :-
  @value = value
end

Instance Attribute Details

#symbolObject (readonly)

Internal



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

def symbol
  @symbol
end

#valueObject (readonly)

Internal



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

def value
  @value
end

Instance Method Details

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

Returns:

  • (Boolean)


21
22
23
# File 'lib/cassanity/decrement.rb', line 21

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