Sha256: 52dc6a04170adbff1af3dc63942be7cba1b8d452e3538d9081a43b2f0bded5e3
Contents?: true
Size: 626 Bytes
Versions: 1
Compression:
Stored size: 626 Bytes
Contents
module LanguageCards module Modes class Game def initialize card_set @card_set = card_set @index = 0 @current = nil end def current @current or raise "Current grapheme not yet set!" end # @return Grapheme Returns a random grapheme def sample @current = @card_set.sample end # Iterator for cycling through all translations sequentially. # @return Grapheme Returns a random grapheme def next value = @card_set[@index % @card_set.length] @index += 1 @current = value end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
language_cards-0.2.0 | lib/language_cards/modes/game.rb |