Class: Kredis::Types::Cycle

Inherits:
Counter show all
Defined in:
lib/kredis/types/cycle.rb

Instance Attribute Summary collapse

Attributes inherited from Counter

#expires_in

Attributes inherited from Proxying

#key, #proxy

Instance Method Summary collapse

Methods inherited from Counter

#decrement, #increment, #reset

Methods included from DefaultValues

#initialize

Methods inherited from Proxying

#failsafe, #initialize, proxying, #unproxied_redis

Instance Attribute Details

#valuesObject

Returns the value of attribute values.



4
5
6
# File 'lib/kredis/types/cycle.rb', line 4

def values
  @values
end

Instance Method Details

#indexObject



6
# File 'lib/kredis/types/cycle.rb', line 6

alias index value

#nextObject



12
13
14
# File 'lib/kredis/types/cycle.rb', line 12

def next
  set (index + 1) % values.size
end

#valueObject



8
9
10
# File 'lib/kredis/types/cycle.rb', line 8

def value
  values[index]
end