Class: CliEplTable::Team
- Inherits:
-
Object
- Object
- CliEplTable::Team
- Defined in:
- lib/cli_epl_table/team.rb
Constant Summary collapse
- @@all =
[]
Instance Attribute Summary collapse
-
#games_drawn ⇒ Object
Returns the value of attribute games_drawn.
-
#games_lost ⇒ Object
Returns the value of attribute games_lost.
-
#games_played ⇒ Object
Returns the value of attribute games_played.
-
#games_won ⇒ Object
Returns the value of attribute games_won.
-
#goal_differential ⇒ Object
Returns the value of attribute goal_differential.
-
#goals_against ⇒ Object
Returns the value of attribute goals_against.
-
#goals_for ⇒ Object
Returns the value of attribute goals_for.
-
#name ⇒ Object
Returns the value of attribute name.
-
#points ⇒ Object
Returns the value of attribute points.
-
#position ⇒ Object
Returns the value of attribute position.
Class Method Summary collapse
-
.all ⇒ Object
define all.
Instance Method Summary collapse
-
#initialize(data) ⇒ Team
constructor
init all teams with corresponding attributes from the scraped data.
Constructor Details
#initialize(data) ⇒ Team
init all teams with corresponding attributes from the scraped data
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# 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 |
Instance Attribute Details
#games_drawn ⇒ Object
Returns the value of attribute games_drawn.
2 3 4 |
# File 'lib/cli_epl_table/team.rb', line 2 def games_drawn @games_drawn end |
#games_lost ⇒ Object
Returns the value of attribute games_lost.
2 3 4 |
# File 'lib/cli_epl_table/team.rb', line 2 def games_lost @games_lost end |
#games_played ⇒ Object
Returns the value of attribute games_played.
2 3 4 |
# File 'lib/cli_epl_table/team.rb', line 2 def games_played @games_played end |
#games_won ⇒ Object
Returns the value of attribute games_won.
2 3 4 |
# File 'lib/cli_epl_table/team.rb', line 2 def games_won @games_won end |
#goal_differential ⇒ Object
Returns the value of attribute goal_differential.
2 3 4 |
# File 'lib/cli_epl_table/team.rb', line 2 def goal_differential @goal_differential end |
#goals_against ⇒ Object
Returns the value of attribute goals_against.
2 3 4 |
# File 'lib/cli_epl_table/team.rb', line 2 def goals_against @goals_against end |
#goals_for ⇒ Object
Returns the value of attribute goals_for.
2 3 4 |
# File 'lib/cli_epl_table/team.rb', line 2 def goals_for @goals_for end |
#name ⇒ Object
Returns the value of attribute name.
2 3 4 |
# File 'lib/cli_epl_table/team.rb', line 2 def name @name end |
#points ⇒ Object
Returns the value of attribute points.
2 3 4 |
# File 'lib/cli_epl_table/team.rb', line 2 def points @points end |
#position ⇒ Object
Returns the value of attribute position.
2 3 4 |
# File 'lib/cli_epl_table/team.rb', line 2 def position @position end |
Class Method Details
.all ⇒ Object
define all
6 7 8 |
# File 'lib/cli_epl_table/team.rb', line 6 def self.all @@all end |