Class: NpbApi::Hitting
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from NpbApi::Base
Instance Method Details
#table ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/npb_api/hitting.rb', line 5 def table extracted_table.map do |values| values.unshift(@year, @team, @league) hash = Hash[*[keys, values].transpose.flatten] hash.map do |key, value| case key when :bat [key, bat(value)] when :year, :team, :league, :player [key, value] when :batting_average, :slugging_percentage, :on_base_percentage [key, value.to_f] else [key, value.to_i] end end.to_h end end |