Class: TorqueBox::Infinispan::Sequence
- Inherits:
-
Object
- Object
- TorqueBox::Infinispan::Sequence
- Defined in:
- lib/sequence.rb
Defined Under Namespace
Classes: Codec
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(amount = 1) ⇒ Sequence
constructor
A new instance of Sequence.
- #next(amount = 1) ⇒ Object
- #to_s ⇒ Object
- #value ⇒ Object
Constructor Details
#initialize(amount = 1) ⇒ Sequence
Returns a new instance of Sequence.
34 35 36 |
# File 'lib/sequence.rb', line 34 def initialize(amount = 1) @data = amount end |
Instance Method Details
#==(other) ⇒ Object
46 47 48 |
# File 'lib/sequence.rb', line 46 def ==(other) self.value == other.value end |
#next(amount = 1) ⇒ Object
42 43 44 |
# File 'lib/sequence.rb', line 42 def next(amount = 1) Sequence.new( @data.to_i + amount ) end |
#to_s ⇒ Object
50 51 52 |
# File 'lib/sequence.rb', line 50 def to_s "Sequence: #{self.value}" end |
#value ⇒ Object
38 39 40 |
# File 'lib/sequence.rb', line 38 def value @data ? @data.to_i : @data end |