Class: NpbApi::Fielding
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 23 24 25 26 27 28 |
# File 'lib/npb_api/fielding.rb', line 5 def table position = '' extracted_table.map do |values| if values[0] =~ /\A【(.+)】\z/ position = human_position($1) next end values.unshift(@year, @team, @league, position) _hash(keys, values).map do |key, value| case key when :throw [key, _throw(value)] when :year, :team, :league, :position, :player [key, value] when :fielding_percentage [key, value.to_f] when :passed_balls [key, (value.empty? ? 'NULL' : value.to_i)] else [key, value.to_i] end end.to_h end.compact end |