Class: Riak::Crdt::BatchCounter

Inherits:
Object
  • Object
show all
Defined in:
lib/riak/crdt/batch_counter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeBatchCounter

Returns a new instance of BatchCounter.



6
7
8
# File 'lib/riak/crdt/batch_counter.rb', line 6

def initialize
  @accumulator = 0
end

Instance Attribute Details

#accumulatorObject (readonly)

Returns the value of attribute accumulator.



4
5
6
# File 'lib/riak/crdt/batch_counter.rb', line 4

def accumulator
  @accumulator
end

Instance Method Details

#decrement(amount = 1) ⇒ Object



14
15
16
# File 'lib/riak/crdt/batch_counter.rb', line 14

def decrement(amount = 1)
  increment -amount
end

#increment(amount = 1) ⇒ Object



10
11
12
# File 'lib/riak/crdt/batch_counter.rb', line 10

def increment(amount = 1)
  @accumulator += amount
end