lib/baseball/player.rb in baseball-2.0.2 vs lib/baseball/player.rb in baseball-2.1.0
- old
+ new
@@ -66,9 +66,14 @@
else
isolated_power
end
end
+ def babip
+ initial_babip = (hits - hr).to_f / (at_bats - so - hr + sac_flies).to_f
+ figure_lead_and_trailing_zeroes(initial_babip.round(3))
+ end
+
def fielding_percentage
plays = put_outs + assists
plays_plus_errors = plays + errors
player_avg = plays.to_f / plays_plus_errors.to_f
avg = player_avg.round(3)