Sha256: b4b206d8b4ee8f7980cfe8635b9a1c9e928fa21acc745a9f7511ccec5d1265c8

Contents?: true

Size: 367 Bytes

Versions: 2

Compression:

Stored size: 367 Bytes

Contents

require 'baseball/player'

module Fielding

  class Fielder < Player::PlayerTemplate

    def fielding_percentage
      plays = @player[:put_outs] + @player[:assists]
      plays_plus_errors = plays + @player[:errors]
      player_avg = plays.to_f / plays_plus_errors.to_f
      avg = player_avg.round(3)
      figure_lead_and_trailing_zeroes(avg)
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
baseball-1.2.0 lib/baseball/fielding.rb
baseball-1.1.0 lib/baseball/fielding.rb