Module: Iterable

Included in:
Array
Defined in:
lib/cartesian_iterator.rb

Instance Method Summary collapse

Instance Method Details

#nextObject



60
61
62
63
# File 'lib/cartesian_iterator.rb', line 60

def next
  @next_index or restart
  raw_next
end

#raw_nextObject



65
66
67
# File 'lib/cartesian_iterator.rb', line 65

def raw_next
  self[@next_index += 1]
end

#restart_and_raw_nextObject



69
70
71
# File 'lib/cartesian_iterator.rb', line 69

def restart_and_raw_next
  self[@next_index = 0]
end

#startObject Also known as: restart



54
55
56
57
# File 'lib/cartesian_iterator.rb', line 54

def start
  @next_index = -1
  true
end