Class: Bicycle::Methods::Cycle

Inherits:
Object
  • Object
show all
Defined in:
lib/bicycle/methods.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(values) ⇒ Cycle

Returns a new instance of Cycle.



47
48
49
50
# File 'lib/bicycle/methods.rb', line 47

def initialize(values)
  @values = values
  reset
end

Instance Attribute Details

#valuesObject (readonly)

Returns the value of attribute values.



45
46
47
# File 'lib/bicycle/methods.rb', line 45

def values
  @values
end

Instance Method Details

#current_valueObject



56
57
58
# File 'lib/bicycle/methods.rb', line 56

def current_value
  @values[previous_index].to_s
end

#resetObject



52
53
54
# File 'lib/bicycle/methods.rb', line 52

def reset
  @index = 0
end

#to_sObject



60
61
62
63
64
# File 'lib/bicycle/methods.rb', line 60

def to_s
  value = @values[@index].to_s
  @index = next_index
  value
end