Class: TorqueBox::Infinispan::Sequence

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

Defined Under Namespace

Classes: Codec

Instance Method Summary collapse

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_sObject



50
51
52
# File 'lib/sequence.rb', line 50

def to_s
  "Sequence: #{self.value}"
end

#valueObject



38
39
40
# File 'lib/sequence.rb', line 38

def value
  @data ? @data.to_i : @data
end