Module: Redis::Objects::Counters::InstanceMethods

Defined in:
lib/redis/objects/counters.rb

Overview

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

Instance Method Summary (collapse)

Instance Method Details

- (Object) decrement(name, by = 1)

Decrement a counter. It is more efficient to use increment_ directly. This is mainly just for completeness to override ActiveRecord.



148
149
150
151
152
153
154
# File 'lib/redis/objects/counters.rb', line 148

def decrement(name, by=1)
  if self.class.send("counter_defined?", name)
    send(name).decrement(by)
  else
    super
  end
end

- (Object) increment(name, by = 1)

Increment a counter. It is more efficient to use increment_ directly. This is mainly just for completeness to override ActiveRecord.



137
138
139
140
141
142
143
# File 'lib/redis/objects/counters.rb', line 137

def increment(name, by=1)
  if self.class.send("counter_defined?", name)
    send(name).increment(by)
  else
    super
  end
end