Module: NBA::CumeStatsPlayer::GameAttributes Private

Defined in:
lib/nba/cume_stats_player.rb

Overview

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

Extracts game attributes from row data

Class Method Summary collapse

Class Method Details

.extract(data) ⇒ Hash

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.

Extracts all game attributes from data

Parameters:

  • data (Hash)

    the row data

Returns:

  • (Hash)

    extracted attributes



158
159
160
# File 'lib/nba/cume_stats_player.rb', line 158

def self.extract(data)
  identity(data).merge(stats(data))
end

.identity(data) ⇒ Hash

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.

Extracts identity attributes from data

Parameters:

  • data (Hash)

    the row data

Returns:

  • (Hash)

    identity attributes



166
167
168
169
170
171
172
173
174
175
# File 'lib/nba/cume_stats_player.rb', line 166

def self.identity(data)
  {
    game_id: data["GAME_ID"],
    matchup: data["MATCHUP"],
    game_date: data["GAME_DATE"],
    vs_team_id: data["VS_TEAM_ID"],
    vs_team_city: data["VS_TEAM_CITY"],
    vs_team_name: data["VS_TEAM_NAME"]
  }
end

.other(data) ⇒ Hash

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.

Extracts other stat attributes from data

Parameters:

  • data (Hash)

    the row data

Returns:

  • (Hash)

    other stat attributes



217
218
219
220
221
222
# File 'lib/nba/cume_stats_player.rb', line 217

def self.other(data)
  {
    ast: data["AST"], pf: data["PF"], stl: data["STL"],
    tov: data["TOV"], blk: data["BLK"], pts: data["PTS"]
  }
end

.rebounds(data) ⇒ Hash

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.

Extracts rebound attributes from data

Parameters:

  • data (Hash)

    the row data

Returns:

  • (Hash)

    rebound attributes



209
210
211
# File 'lib/nba/cume_stats_player.rb', line 209

def self.rebounds(data)
  {oreb: data["OREB"], dreb: data["DREB"], reb: data["REB"]}
end

.shooting(data) ⇒ Hash

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.

Extracts shooting attributes from data

Parameters:

  • data (Hash)

    the row data

Returns:

  • (Hash)

    shooting attributes



197
198
199
200
201
202
203
# File 'lib/nba/cume_stats_player.rb', line 197

def self.shooting(data)
  {
    fgm: data["FGM"], fga: data["FGA"], fg_pct: data["FG_PCT"],
    fg3m: data["FG3M"], fg3a: data["FG3A"], fg3_pct: data["FG3_PCT"],
    ftm: data["FTM"], fta: data["FTA"], ft_pct: data["FT_PCT"]
  }
end

.stats(data) ⇒ Hash

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.

Extracts stat attributes from data

Parameters:

  • data (Hash)

    the row data

Returns:

  • (Hash)

    stat attributes



181
182
183
# File 'lib/nba/cume_stats_player.rb', line 181

def self.stats(data)
  time(data).merge(shooting(data)).merge(rebounds(data)).merge(other(data))
end

.time(data) ⇒ Hash

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.

Extracts time attributes from data

Parameters:

  • data (Hash)

    the row data

Returns:

  • (Hash)

    time attributes



189
190
191
# File 'lib/nba/cume_stats_player.rb', line 189

def self.time(data)
  {min: data["MIN"], sec: data["SEC"]}
end