module Pc::Tournament

Public Instance Methods

loaded_games() click to toggle source
# File lib/pc/tournament.rb, line 15
def loaded_games
  Dir[File.dirname(__FILE__) + '/games/*.rb'].each {|file| require file }

  {exit: -> {goodbye}}.tap do |games|
    ObjectSpace.each_object(Game) do |game|
      unless game == Pc::Game
        games[game.to_s] = ->{play game}
      end
    end
  end
end
play(game) click to toggle source
# File lib/pc/tournament.rb, line 27
def play(game)
  game.run @interface, @options
  say %{Get ready for the next one}, next: ->{select_game}
end
select_game() click to toggle source
# File lib/pc/tournament.rb, line 11
def select_game
  ask %{Pick a game}, loaded_games
end
welcome() click to toggle source
# File lib/pc/tournament.rb, line 7
def welcome
  say %{Welcome}, next: ->{select_game}
end