Class: CricInfo::Innings

Inherits:
Object
  • Object
show all
Defined in:
lib/cricinfo/innings.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#declaredObject

Returns the value of attribute declared.



5
6
7
# File 'lib/cricinfo/innings.rb', line 5

def declared
  @declared
end

#oversObject

Returns the value of attribute overs.



5
6
7
# File 'lib/cricinfo/innings.rb', line 5

def overs
  @overs
end

#runsObject

Returns the value of attribute runs.



5
6
7
# File 'lib/cricinfo/innings.rb', line 5

def runs
  @runs
end

#teamObject

Returns the value of attribute team.



5
6
7
# File 'lib/cricinfo/innings.rb', line 5

def team
  @team
end

#wicketsObject

Returns the value of attribute wickets.



5
6
7
# File 'lib/cricinfo/innings.rb', line 5

def wickets
  @wickets
end

Instance Method Details

#summaryObject

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