Class: Infostrada::TableEntry
- Inherits:
-
Object
- Object
- Infostrada::TableEntry
- Defined in:
- lib/infostrada/table.rb
Instance Attribute Summary collapse
-
#goals_against ⇒ Object
Returns the value of attribute goals_against.
-
#goals_for ⇒ Object
Returns the value of attribute goals_for.
-
#matches ⇒ Object
Returns the value of attribute matches.
-
#matches_drawn ⇒ Object
Returns the value of attribute matches_drawn.
-
#matches_lost ⇒ Object
Returns the value of attribute matches_lost.
-
#matches_won ⇒ Object
Returns the value of attribute matches_won.
-
#points ⇒ Object
Returns the value of attribute points.
-
#rank ⇒ Object
Returns the value of attribute rank.
-
#team_id ⇒ Object
Returns the value of attribute team_id.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(hash = {}, &block) ⇒ TableEntry
constructor
A new instance of TableEntry.
Constructor Details
#initialize(hash = {}, &block) ⇒ TableEntry
67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/infostrada/table.rb', line 67 def initialize(hash = {}, &block) @team_id = hash['n_TeamID'] @rank = hash['n_RankSort'] @matches = hash['n_Matches'] @matches_won = hash['n_MatchesWon'] @matches_drawn = hash['n_MatchesDrawn'] @matches_lost = hash['n_MatchesLost'] @points = hash['n_Points'] @goals_for = hash['n_GoalsFor'] @goals_against = hash['n_GoalsAgainst'] block.call(self) if block_given? self end |
Instance Attribute Details
#goals_against ⇒ Object
Returns the value of attribute goals_against.
51 52 53 |
# File 'lib/infostrada/table.rb', line 51 def goals_against @goals_against end |
#goals_for ⇒ Object
Returns the value of attribute goals_for.
51 52 53 |
# File 'lib/infostrada/table.rb', line 51 def goals_for @goals_for end |
#matches ⇒ Object
Returns the value of attribute matches.
50 51 52 |
# File 'lib/infostrada/table.rb', line 50 def matches @matches end |
#matches_drawn ⇒ Object
Returns the value of attribute matches_drawn.
50 51 52 |
# File 'lib/infostrada/table.rb', line 50 def matches_drawn @matches_drawn end |
#matches_lost ⇒ Object
Returns the value of attribute matches_lost.
51 52 53 |
# File 'lib/infostrada/table.rb', line 51 def matches_lost @matches_lost end |
#matches_won ⇒ Object
Returns the value of attribute matches_won.
50 51 52 |
# File 'lib/infostrada/table.rb', line 50 def matches_won @matches_won end |
#points ⇒ Object
Returns the value of attribute points.
51 52 53 |
# File 'lib/infostrada/table.rb', line 51 def points @points end |
#rank ⇒ Object
Returns the value of attribute rank.
50 51 52 |
# File 'lib/infostrada/table.rb', line 50 def rank @rank end |
#team_id ⇒ Object
Returns the value of attribute team_id.
50 51 52 |
# File 'lib/infostrada/table.rb', line 50 def team_id @team_id end |
Class Method Details
.from_json(json = {}) ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/infostrada/table.rb', line 53 def self.from_json(json = {}) self.new do |table_entry| table_entry.team_id = json['team_id'] table_entry.rank = json['rank'] table_entry.matches = json['matches'] table_entry.matches_won = json['matches_won'] table_entry.matches_drawn = json['matches_drawn'] table_entry.matches_lost = json['matches_lost'] table_entry.points = json['points'] table_entry.goals_for = json['goals_for'] table_entry.goals_against = json['goals_against'] end end |