Module: Stats
- Included in:
- Stats
- Defined in:
- lib/stats.rb,
lib/stats/times.rb,
lib/stats/helpers.rb,
lib/stats/timing_stat.rb
Defined Under Namespace
Modules: Helpers, Times Classes: TimingStat
Instance Method Summary collapse
-
#clear(name) ⇒ Object
Clears the stat with the specified name.
-
#counter(name) ⇒ Object
Returns the value of the counter with the specified name.
-
#decr(name, by = 1) ⇒ Object
Decrements the stat with the specified name.
-
#get(name) ⇒ Object
Returns the value with the specified name.
-
#incr(name, by = 1) ⇒ Object
Increments the stat with the specified name.
-
#set(name, value) ⇒ Object
Sets the stat with the specified name.
Methods included from Helpers
Methods included from Times
Instance Method Details
#clear(name) ⇒ Object
Clears the stat with the specified name.
38 39 40 |
# File 'lib/stats.rb', line 38 def clear(name) Stats.redis.del(name) end |
#counter(name) ⇒ Object
Returns the value of the counter with the specified name.
33 34 35 |
# File 'lib/stats.rb', line 33 def counter(name) Stats.redis.get(name).to_i end |
#decr(name, by = 1) ⇒ Object
Decrements the stat with the specified name.
28 29 30 |
# File 'lib/stats.rb', line 28 def decr(name, by = 1) Stats.redis.decrby(name, by) end |
#get(name) ⇒ Object
Returns the value with the specified name.
18 19 20 |
# File 'lib/stats.rb', line 18 def get(name) Stats.redis.get(name) end |