Sha256: 5ff8f650287ad9fde3ae97debbf79944addc405bea1104cad93939b5516555e0

Contents?: true

Size: 820 Bytes

Versions: 1

Compression:

Stored size: 820 Bytes

Contents

require_relative 'card_collection'
require_relative 'user_interface'

module LanguageCards
  class LanguageCards
    def initialize
      @CARDS = {}

      Dir[File.join(File.expand_path(File.join('..','..','..'), __FILE__), 'cards', '*.yml')].+(
      Dir[File.join(File.expand_path(ENV['HOME']), '.language_cards', 'cards', '*.yml')]).
        each do |c|
        next unless yaml_data = YAML.load(File.open(c).read)
        for language in yaml_data.keys do
          if @CARDS.has_key? language
            @CARDS[language] = Hash(@CARDS[language]).merge(Hash(yaml_data[language]))
          else
            @CARDS.merge!({language => yaml_data[language]})
          end
        end

      end
      @CARDS = CardCollection.new @CARDS
    end

    def start
      UserInterface.new.start(@CARDS)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
language_cards-0.0.5 lib/language_cards/language_cards.rb