Class: Sphyg::Enumerators::Cycle

Inherits:
Base
  • Object
show all
Defined in:
lib/sphyg/enumerators/cycle.rb

Overview

Loops through each individual frame of the given sequence. Just like Enumerator#next but wraps around the array.

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Sphyg::Enumerators::Base

Instance Method Details

#nextObject



8
9
10
11
# File 'lib/sphyg/enumerators/cycle.rb', line 8

def next
  @frames_index ||= 0
  @frames[(@frames_index += 1) % @frames.length]
end