class NpbApi::Stats::Pitching

Public Class Methods

url_key() click to toggle source
# File lib/npb-api/stats/pitching.rb, line 4
def self.url_key
  'p'
end

Public Instance Methods

balks() click to toggle source
# File lib/npb-api/stats/pitching.rb, line 103
def balks
  line = (farm? ? 24 : 26)
  @row.children[line].text.to_i
end
complete_games() click to toggle source
# File lib/npb-api/stats/pitching.rb, line 38
def complete_games
  line = (farm? ? 8 : 10)
  @row.children[line].text.to_i
end
earned_run_average() click to toggle source
# File lib/npb-api/stats/pitching.rb, line 118
def earned_run_average
  line = (farm? ? 27 : 29)
  @row.children[line].text.to_f
end
earned_runs() click to toggle source
# File lib/npb-api/stats/pitching.rb, line 113
def earned_runs
  line = (farm? ? 26 : 28)
  @row.children[line].text.to_i
end
games() click to toggle source
# File lib/npb-api/stats/pitching.rb, line 12
def games
  @row.children[4].text.to_i
end
hit_by_pitch() click to toggle source
# File lib/npb-api/stats/pitching.rb, line 88
def hit_by_pitch
  line = (farm? ? 21 : 23)
  @row.children[line].text.to_i
end
hits() click to toggle source
# File lib/npb-api/stats/pitching.rb, line 68
def hits
  line = (farm? ? 16 : 18)
  @row.children[line].text.to_i
end
hold_points() click to toggle source
# File lib/npb-api/stats/pitching.rb, line 33
def hold_points
  return nil if farm?
  @row.children[9].text.to_i
end
holds() click to toggle source
# File lib/npb-api/stats/pitching.rb, line 28
def holds
  return nil if farm?
  @row.children[8].text.to_i
end
home_runs() click to toggle source
# File lib/npb-api/stats/pitching.rb, line 73
def home_runs
  line = (farm? ? 18 : 20)
  @row.children[line].text.to_i
end
innings_pitched() click to toggle source
# File lib/npb-api/stats/pitching.rb, line 63
def innings_pitched
  line1, line2 = (farm? ? [14, 15] : [16, 17])
  (@row.children[line1].text + @row.children[line2].text).to_f
end
intentional_walks() click to toggle source
# File lib/npb-api/stats/pitching.rb, line 83
def intentional_walks
  line = (farm? ? 20 : 22)
  @row.children[line].text.to_i
end
loses() click to toggle source
# File lib/npb-api/stats/pitching.rb, line 20
def loses
  @row.children[6].text.to_i
end
player() click to toggle source
# File lib/npb-api/stats/pitching.rb, line 8
def player
  @row.children[2].text
end
runs() click to toggle source
# File lib/npb-api/stats/pitching.rb, line 108
def runs
  line = (farm? ? 25 : 27)
  @row.children[line].text.to_i
end
saves() click to toggle source
# File lib/npb-api/stats/pitching.rb, line 24
def saves
  @row.children[7].text.to_i
end
shutouts() click to toggle source
# File lib/npb-api/stats/pitching.rb, line 43
def shutouts
  line = (farm? ? 9 : 11)
  @row.children[line].text.to_i
end
strikeouts() click to toggle source
# File lib/npb-api/stats/pitching.rb, line 93
def strikeouts
  line = (farm? ? 22 : 24)
  @row.children[line].text.to_i
end
total_batters_faced() click to toggle source
# File lib/npb-api/stats/pitching.rb, line 58
def total_batters_faced
  line = (farm? ? 13 : 15)
  @row.children[line].text.to_i
end
walks() click to toggle source
# File lib/npb-api/stats/pitching.rb, line 78
def walks
  line = (farm? ? 19 : 21)
  @row.children[line].text.to_i
end
wild_pitches() click to toggle source
# File lib/npb-api/stats/pitching.rb, line 98
def wild_pitches
  line = (farm? ? 23 : 25)
  @row.children[line].text.to_i
end
winning_percentage() click to toggle source
# File lib/npb-api/stats/pitching.rb, line 53
def winning_percentage
  line = (farm? ? 12 : 14)
  @row.children[line].text.to_f
end
wins() click to toggle source
# File lib/npb-api/stats/pitching.rb, line 16
def wins
  @row.children[5].text.to_i
end
without_walking() click to toggle source
# File lib/npb-api/stats/pitching.rb, line 48
def without_walking
  line = (farm? ? 10 : 12)
  @row.children[line].text.to_i
end

Private Instance Methods

farm?() click to toggle source
# File lib/npb-api/stats/pitching.rb, line 125
def farm?
  %w[eastern western].include?(league)
end