Class: MimiCheck::Generator::Carousel
- Inherits:
-
Object
- Object
- MimiCheck::Generator::Carousel
- Includes:
- MimiCheck::Generator
- Defined in:
- lib/mimicheck/generator/carousel.rb
Instance Method Summary collapse
- #generate ⇒ Object
-
#initialize(*elements) ⇒ Carousel
constructor
A new instance of Carousel.
Methods included from MimiCheck::Generator
Constructor Details
#initialize(*elements) ⇒ Carousel
Returns a new instance of Carousel.
6 7 8 9 |
# File 'lib/mimicheck/generator/carousel.rb', line 6 def initialize(*elements) @elements = elements @current = -1 end |
Instance Method Details
#generate ⇒ Object
13 14 15 16 |
# File 'lib/mimicheck/generator/carousel.rb', line 13 def generate return nil unless elements.size.nonzero? elements[(@current += 1) % elements.size] end |