Method: Dynamoid::Persistence#increment

Defined in:
lib/dynamoid/persistence.rb

#increment(attribute, by = 1) ⇒ Object

Initializes attribute to zero if nil and adds the value passed as by (default is 1). Only makes sense for number-based attributes. Returns self.



221
222
223
224
225
# File 'lib/dynamoid/persistence.rb', line 221

def increment(attribute, by = 1)
  self[attribute] ||= 0
  self[attribute] += by
  self
end