Created
July 29, 2013 17:55
-
-
Save clay-whitley/6106215 to your computer and use it in GitHub Desktop.
wax on/wax off
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'csv' | |
| module FlashCardDB | |
| def self.parse | |
| result = [] | |
| CSV.foreach("flashcards.csv") do |row| | |
| unless row[0] == "definition" | |
| result << {definition: row[0], term: row[1]} | |
| end | |
| end | |
| result | |
| end | |
| end | |
| class GameController | |
| def self.start_game | |
| card_args = FlashCardDB.parse | |
| deck = Deck.new | |
| card_args.each do |arg| | |
| deck.add_card(arg) | |
| end | |
| game = Game.new(deck) | |
| game.play_game | |
| end | |
| end | |
| GameController.start_game |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| definition | term | |
|---|---|---|
| bar | foo | |
| buzz | baz | |
| things | stuff | |
| some stuff | random term | |
| has a nice haircut | clay |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment