Module: NBA::CLI::Display::PlayerDisplay

Included in:
NBA::CLI::Display
Defined in:
lib/nba/cli/display/player_display.rb

Overview

Helper methods for displaying player info

Instance Method Summary collapse

Instance Method Details

#display_player(player) ⇒ void

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

This method returns an undefined value.

Displays detailed information for a single player

Parameters:

  • player (Player)

    the player to display



21
22
23
24
25
26
27
28
29
# File 'lib/nba/cli/display/player_display.rb', line 21

def display_player(player)
  detail = Players.find(player)
  return say("Player not found") unless detail

  say(format_label("Name", detail.full_name))
  say(format_label("Status", detail.active? ? "Active" : "Inactive"))
  display_player_physical(detail)
  display_player_draft(detail)
end

#display_player_draft(player) ⇒ void

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

This method returns an undefined value.

Displays player draft info

Parameters:

  • player (Player)

    the player



47
48
49
50
51
52
# File 'lib/nba/cli/display/player_display.rb', line 47

def display_player_draft(player)
  return say(format_label("Draft", "Undrafted")) unless player.draft_year

  draft = format_draft_info(player)
  say(format_label("Draft", draft))
end

#display_player_physical(player) ⇒ void

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

This method returns an undefined value.

Displays player physical info

Parameters:

  • player (Player)

    the player



36
37
38
39
40
# File 'lib/nba/cli/display/player_display.rb', line 36

def display_player_physical(player)
  display_player_position(player)
  display_player_body(player)
  display_player_origin(player)
end

#display_players(players_list) ⇒ void

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

This method returns an undefined value.

Displays a list of players from search

Parameters:

  • players_list (Collection)

    the players to display



11
12
13
14
# File 'lib/nba/cli/display/player_display.rb', line 11

def display_players(players_list)
  say("Found #{players_list.size} player(s):")
  players_list.each { |player| say(format_player_result(player)) }
end