Sha256: 43d7e477389b0188a47359a085d551fc22ec7a0da1959f4b02d32f4bfdac8a40
Contents?: true
Size: 639 Bytes
Versions: 3
Compression:
Stored size: 639 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 self 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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
language_cards-0.3.2 | lib/language_cards/modes/game.rb |
language_cards-0.3.1 | lib/language_cards/modes/game.rb |
language_cards-0.3.0 | lib/language_cards/modes/game.rb |