module Redis::Objects::Counters::InstanceMethods

Instance methods that appear in your class when you include Redis::Objects.

Public Instance Methods

decrement(name, by=1) click to toggle source

Decrement a counter. Called mainly in the context of :counter_cache

Calls superclass method
# File lib/redis/objects/counters.rb, line 145
def decrement(name, by=1)
  if self.class.counter_defined?(name)
    send(name).decrement(by)
  else
    super # ActiveRecord
  end
end
increment(name, by=1) click to toggle source

Increment a counter. Called mainly in the context of :counter_cache

Calls superclass method
# File lib/redis/objects/counters.rb, line 136
def increment(name, by=1)
  if self.class.counter_defined?(name)
    send(name).increment(by)
  else
    super # ActiveRecord
  end
end