class CliEplTable::Team

Attributes

games_drawn[RW]
games_lost[RW]
games_played[RW]
games_won[RW]
goal_differential[RW]
goals_against[RW]
goals_for[RW]
name[RW]
points[RW]
position[RW]

Public Class Methods

all() click to toggle source

define all

# File lib/cli_epl_table/team.rb, line 6
def self.all
  @@all
end
new(data) click to toggle source

init all teams with corresponding attributes from the scraped data

# File lib/cli_epl_table/team.rb, line 11
def initialize(data)
  @position = data.css("span.value").text
  @name = data.css("td.team span.long").text
  @points = data.css("td.points").text
  @games_played = data.css("td")[3].text
  @games_won = data.css("td")[4].text
  @games_drawn = data.css("td")[5].text
  @games_lost = data.css("td")[6].text
  @goals_for = data.css("td")[7].text
  @goals_against = data.css("td")[8].text
  @goal_differential = data.css("td")[9].text.strip
  @@all << self
end