Sha256: 26829322fe777a82df30c5f10bf106dd2bad3ab225b5a0a13acdc0c50d039904

Contents?: true

Size: 689 Bytes

Versions: 1

Compression:

Stored size: 689 Bytes

Contents

require 'baseball/player'

module Running

  class Runner < Player::PlayerTemplate

    def stolen_base_percentage
      player_stolen_base_percentage = @player[:stolen_bases].to_f / (@player[:stolen_bases ].to_f + @player[:caught_stealing].to_f)
      stealing_average = player_stolen_base_percentage.round(3)
      figure_lead_and_trailing_zeroes(stealing_average)
    end

    def stolen_base_runs
      stolen_base_adjustment = @player[:stolen_bases].to_f * 0.3
      caught_stealing_adjustment = @player[:caught_stealing].to_f * 0.6
      adjusted_stolen_base_runs = stolen_base_adjustment - caught_stealing_adjustment
      adjusted_stolen_base_runs.round(3).to_s
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
baseball-1.2.0 lib/baseball/running.rb