class View::SelectTeam
Constants
- SELECT_TEAM_NAME_MESSAGE
- SELECT_TEAM_TYPE_MESSAGE
Public Class Methods
new(select_team_presenter, terminal_util)
click to toggle source
# File lib/tic_tac_toe/view/select_team.rb, line 6 def initialize(select_team_presenter, terminal_util) @select_team_presenter = select_team_presenter @terminal_util = terminal_util end
Public Instance Methods
render()
click to toggle source
# File lib/tic_tac_toe/view/select_team.rb, line 11 def render select_teams end
Private Instance Methods
select_team(team_types)
click to toggle source
# File lib/tic_tac_toe/view/select_team.rb, line 23 def select_team(team_types) display_msg(SELECT_TEAM_TYPE_MESSAGE) team_types.each { |k, v| display_msg("#{v}: #{k}") } type = @terminal_util.get_integer_input raise InvalidSelection, 'Invalid Team Selection :(' if @select_team_presenter.invalid_team_selection?(type) display_msg(SELECT_TEAM_NAME_MESSAGE) name = @terminal_util.get_input { type: type, name: name } end
select_teams()
click to toggle source
# File lib/tic_tac_toe/view/select_team.rb, line 17 def select_teams teams = (1..2).map { |_| select_team(@select_team_presenter.team_types) } @select_team_presenter.set_teams(teams) end