Class: CricInfo::Innings
- Inherits:
-
Object
- Object
- CricInfo::Innings
- Defined in:
- lib/cricinfo/innings.rb
Instance Attribute Summary collapse
-
#declared ⇒ Object
Returns the value of attribute declared.
-
#overs ⇒ Object
Returns the value of attribute overs.
-
#runs ⇒ Object
Returns the value of attribute runs.
-
#team ⇒ Object
Returns the value of attribute team.
-
#wickets ⇒ Object
Returns the value of attribute wickets.
Instance Method Summary collapse
-
#summary ⇒ Object
returns a string summarising the innings data.
Instance Attribute Details
#declared ⇒ Object
Returns the value of attribute declared.
5 6 7 |
# File 'lib/cricinfo/innings.rb', line 5 def declared @declared end |
#overs ⇒ Object
Returns the value of attribute overs.
5 6 7 |
# File 'lib/cricinfo/innings.rb', line 5 def overs @overs end |
#runs ⇒ Object
Returns the value of attribute runs.
5 6 7 |
# File 'lib/cricinfo/innings.rb', line 5 def runs @runs end |
#team ⇒ Object
Returns the value of attribute team.
5 6 7 |
# File 'lib/cricinfo/innings.rb', line 5 def team @team end |
#wickets ⇒ Object
Returns the value of attribute wickets.
5 6 7 |
# File 'lib/cricinfo/innings.rb', line 5 def wickets @wickets end |
Instance Method Details
#summary ⇒ Object
returns a string summarising the innings data
8 9 10 11 12 13 14 15 16 |
# File 'lib/cricinfo/innings.rb', line 8 def summary return '' unless overs || runs # overs can be blank if innings over out = "%s %d" % [team, runs] out += "/%d" % [wickets] if wickets out += " declared" if declared out += " (%s ov)" % [overs] if overs out += "\n" out end |