lib/baseball/pitching.rb in baseball-0.3.1 vs lib/baseball/pitching.rb in baseball-0.4.0

- old
+ new

@@ -1,21 +1,19 @@ +require 'baseball/player' + module Pitching + class Pitcher < Player::PlayerTemplate - class Pitcher - attr_accessor :pitcher_hash - def initialize(pitcher_hash) - @pitcher = pitcher_hash - end def era - earned_runs = @pitcher[:er] * 9 - avg = earned_runs / @pitcher[:ip].to_f + earned_runs = @player[:er] * 9 + avg = earned_runs / @player[:ip].to_f earned_run_average = avg.round(2) end def whip - walks_plus_hits = @pitcher[:walks] + @pitcher[:hits] - whip = walks_plus_hits / @pitcher[:ip].to_f + walks_plus_hits = @player[:walks] + @player[:hits] + whip = walks_plus_hits / @player[:ip].to_f whip = whip.round(3) end end