Sha256: 5bfdb7afe04718dc0c8e3bfae3bb05366995d76f14d0ff4a07f25b0cb6f38162

Contents?: true

Size: 578 Bytes

Versions: 2

Compression:

Stored size: 578 Bytes

Contents

require 'language_cards/menu_node'
require 'language_cards/yaml_loader'
require 'language_cards/user_interface'

module LanguageCards
  class LanguageCards
    def initialize
      self.cards = builder(YAMLLoader.new.load)
    end

    def start
      UserInterface.new(cards).start
    end

    private
    attr_accessor :cards
    def builder(cards_yaml)
      cards_yaml.each_with_object([]) do |(language, values), memo|
        values.each do |category_with_card_set|
          memo << MenuNode.new(language, category_with_card_set)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
language_cards-0.3.2 lib/language_cards/language_cards.rb
language_cards-0.3.1 lib/language_cards/language_cards.rb