Class: NpbApi::Stats::Pitching

Inherits:
Base
  • Object
show all
Defined in:
lib/npb-api/stats/pitching.rb

Constant Summary

Constants inherited from Base

Base::LEAGUES, Base::TEAMS, Base::TEAM_LEAGUES

Instance Attribute Summary

Attributes inherited from Base

#league, #team, #year

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

all, #initialize, list

Constructor Details

This class inherits a constructor from NpbApi::Stats::Base

Class Method Details

.url_keyObject



4
5
6
# File 'lib/npb-api/stats/pitching.rb', line 4

def self.url_key
  'p'
end

Instance Method Details

#balksObject



103
104
105
106
# File 'lib/npb-api/stats/pitching.rb', line 103

def balks
  line = (farm? ? 24 : 26)
  @row.children[line].text.to_i
end

#complete_gamesObject



38
39
40
41
# 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_averageObject



118
119
120
121
# 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_runsObject



113
114
115
116
# File 'lib/npb-api/stats/pitching.rb', line 113

def earned_runs
  line = (farm? ? 26 : 28)
  @row.children[line].text.to_i
end

#gamesObject



12
13
14
# File 'lib/npb-api/stats/pitching.rb', line 12

def games
  @row.children[4].text.to_i
end

#hit_by_pitchObject



88
89
90
91
# File 'lib/npb-api/stats/pitching.rb', line 88

def hit_by_pitch
  line = (farm? ? 21 : 23)
  @row.children[line].text.to_i
end

#hitsObject



68
69
70
71
# File 'lib/npb-api/stats/pitching.rb', line 68

def hits
  line = (farm? ? 16 : 18)
  @row.children[line].text.to_i
end

#hold_pointsObject



33
34
35
36
# File 'lib/npb-api/stats/pitching.rb', line 33

def hold_points
  return nil if farm?
  @row.children[9].text.to_i
end

#holdsObject



28
29
30
31
# File 'lib/npb-api/stats/pitching.rb', line 28

def holds
  return nil if farm?
  @row.children[8].text.to_i
end

#home_runsObject



73
74
75
76
# File 'lib/npb-api/stats/pitching.rb', line 73

def home_runs
  line = (farm? ? 18 : 20)
  @row.children[line].text.to_i
end

#innings_pitchedObject



63
64
65
66
# 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_walksObject



83
84
85
86
# File 'lib/npb-api/stats/pitching.rb', line 83

def intentional_walks
  line = (farm? ? 20 : 22)
  @row.children[line].text.to_i
end

#losesObject



20
21
22
# File 'lib/npb-api/stats/pitching.rb', line 20

def loses
  @row.children[6].text.to_i
end

#playerObject



8
9
10
# File 'lib/npb-api/stats/pitching.rb', line 8

def player
  @row.children[2].text
end

#runsObject



108
109
110
111
# File 'lib/npb-api/stats/pitching.rb', line 108

def runs
  line = (farm? ? 25 : 27)
  @row.children[line].text.to_i
end

#savesObject



24
25
26
# File 'lib/npb-api/stats/pitching.rb', line 24

def saves
  @row.children[7].text.to_i
end

#shutoutsObject



43
44
45
46
# File 'lib/npb-api/stats/pitching.rb', line 43

def shutouts
  line = (farm? ? 9 : 11)
  @row.children[line].text.to_i
end

#strikeoutsObject



93
94
95
96
# File 'lib/npb-api/stats/pitching.rb', line 93

def strikeouts
  line = (farm? ? 22 : 24)
  @row.children[line].text.to_i
end

#total_batters_facedObject



58
59
60
61
# File 'lib/npb-api/stats/pitching.rb', line 58

def total_batters_faced
  line = (farm? ? 13 : 15)
  @row.children[line].text.to_i
end

#walksObject



78
79
80
81
# File 'lib/npb-api/stats/pitching.rb', line 78

def walks
  line = (farm? ? 19 : 21)
  @row.children[line].text.to_i
end

#wild_pitchesObject



98
99
100
101
# File 'lib/npb-api/stats/pitching.rb', line 98

def wild_pitches
  line = (farm? ? 23 : 25)
  @row.children[line].text.to_i
end

#winning_percentageObject



53
54
55
56
# File 'lib/npb-api/stats/pitching.rb', line 53

def winning_percentage
  line = (farm? ? 12 : 14)
  @row.children[line].text.to_f
end

#winsObject



16
17
18
# File 'lib/npb-api/stats/pitching.rb', line 16

def wins
  @row.children[5].text.to_i
end

#without_walkingObject



48
49
50
51
# File 'lib/npb-api/stats/pitching.rb', line 48

def without_walking
  line = (farm? ? 10 : 12)
  @row.children[line].text.to_i
end