Class: Pitching::Pitcher
- Inherits:
-
Player::PlayerTemplate
- Object
- Player::PlayerTemplate
- Pitching::Pitcher
- Defined in:
- lib/baseball/pitching.rb
Instance Attribute Summary
Attributes inherited from Player::PlayerTemplate
Instance Method Summary collapse
Methods inherited from Player::PlayerTemplate
#figure_trailing_zeroes, #initialize
Constructor Details
This class inherits a constructor from Player::PlayerTemplate
Instance Method Details
#era ⇒ Object
7 8 9 10 11 |
# File 'lib/baseball/pitching.rb', line 7 def era earned_runs = @player[:er] * 9 avg = earned_runs / @player[:ip].to_f earned_run_average = avg.round(2) end |
#whip ⇒ Object
13 14 15 16 17 |
# File 'lib/baseball/pitching.rb', line 13 def whip walks_plus_hits = @player[:walks] + @player[:hits] whip = walks_plus_hits / @player[:ip].to_f whip = whip.round(3) end |