Sha256: 2fd9a085f5291acb2fb2c602cebd75dfa712935b86ae9bb3dbe4e59767788061

Contents?: true

Size: 778 Bytes

Versions: 4

Compression:

Stored size: 778 Bytes

Contents

require 'language_cards/models/grapheme'
require 'language_cards/grapheme_builder'
require 'language_cards/modes/typing_practice'
require 'language_cards/modes/translate'

module LanguageCards
  class CardSet
    attr_reader :graphemes
    def initialize(grapheme_hash)
      @graphemes = GraphemeBuilder.(grapheme_hash)
    end

    def sample
      @graphemes.sample
    end

    def mode(mode)
      case mode
      when :translate
        Modes::Translate.new(self)
      when :typing_practice
        Modes::TypingPractice.new(self) 
      else
        raise "Invalid Game Mode!"
      end
    end

    # So as to not interfere with menu naming as this is not meant to
    # be displayed as a string.
    def to_s
      ""
    end

    def label
      []
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
language_cards-0.3.2 lib/language_cards/models/card_set.rb
language_cards-0.3.1 lib/language_cards/models/card_set.rb
language_cards-0.3.0 lib/language_cards/models/card_set.rb
language_cards-0.2.0 lib/language_cards/models/card_set.rb