Class: CARPS::StartGameInterface

Inherits:
QuitInterface show all
Includes:
ControlInterface
Defined in:
lib/carps/service/start/interface.rb

Overview

Interface to start games

Direct Known Subclasses

DM::StartInterface, Player::StartInterface

Class Method Summary collapse

Instance Method Summary collapse

Methods included from ControlInterface

#quit

Methods inherited from Interface

#run

Constructor Details

#initialize(continuation, mailer, game_config, manager) ⇒ StartGameInterface

Returns a new instance of StartGameInterface.



43
44
45
46
47
48
49
50
51
52
# File 'lib/carps/service/start/interface.rb', line 43

def initialize continuation, mailer, game_config, manager
   @manager = manager
   @manager.none
   @mailer = mailer
   @game_config = game_config
   @continuation = continuation
   super()
   add_command "games", "List existing games."
   add_command "load", "Load an existing game.", "NAME"
end

Class Method Details

.start_game_interface(mailer, config, manager) ⇒ Object

Start interface



33
34
35
36
37
38
39
40
41
# File 'lib/carps/service/start/interface.rb', line 33

def StartGameInterface.start_game_interface mailer, config, manager
   loop do
      choice = callcc do |continuation|
         interface = self.new continuation, mailer, config, manager
         interface.run
      end
      choice.call
   end
end