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, #redis

Instance Method Summary collapse

Methods inherited from Counter

#decrement, #increment, #reset

Methods inherited from Proxying

#failsafe, #initialize, proxying

Constructor Details

This class inherits a constructor from Kredis::Types::Proxying

Instance Attribute Details

#valuesObject

Returns the value of attribute values.



2
3
4
# File 'lib/kredis/types/cycle.rb', line 2

def values
  @values
end

Instance Method Details

#indexObject



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

alias index value

#nextObject



10
11
12
# File 'lib/kredis/types/cycle.rb', line 10

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

#valueObject



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

def value
  values[index]
end