Sha256: fae33c687e71df236d1ea21e1a94275af1ece455eac3a92f914d7abfce9764c6

Contents?: true

Size: 334 Bytes

Versions: 1

Compression:

Stored size: 334 Bytes

Contents

module Bicycle

  # Function to return a single value from an array of
  # given values that you want to cycle through.
  # @param [Array] *to_cycle - values to cycle through
  # @return [?] one of the values in a given order
  def self.cycle(*to_cycle)
    return to_cycle[@_cycle = ((@_cycle || -1) + 1) % to_cycle.count]
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bicycle-0.0.1 lib/bicycle.rb