Class: NpbApi::Stats::Hitting

Inherits:
Base
  • Object
show all
Defined in:
lib/npb-api/stats/hitting.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/hitting.rb', line 4

def self.url_key
  'b'
end

Instance Method Details

#at_batsObject



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

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

#bases_on_ballsObject



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

def bases_on_balls
  @row.children[19].text.to_i
end

#batting_averageObject



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

def batting_average
  @row.children[25].text.to_f
end

#caught_stealingObject



56
57
58
# File 'lib/npb-api/stats/hitting.rb', line 56

def caught_stealing
  @row.children[16].text.to_i
end

#doubleObject



32
33
34
# File 'lib/npb-api/stats/hitting.rb', line 32

def double
  @row.children[9].text.to_i
end

#gamesObject



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

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

#grounded_into_double_playObject



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

def grounded_into_double_play
  @row.children[24].text.to_i
end

#hit_by_pitchObject



76
77
78
# File 'lib/npb-api/stats/hitting.rb', line 76

def hit_by_pitch
  @row.children[22].text.to_i
end

#hitsObject



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

def hits
  @row.children[8].text.to_i
end

#home_runsObject



40
41
42
# File 'lib/npb-api/stats/hitting.rb', line 40

def home_runs
  @row.children[11].text.to_i
end

#intentional_bases_on_ballsObject



72
73
74
# File 'lib/npb-api/stats/hitting.rb', line 72

def intentional_bases_on_balls
  @row.children[21].text.to_i
end

#on_base_percentageObject



96
97
98
# File 'lib/npb-api/stats/hitting.rb', line 96

def on_base_percentage
  @row.children[27].text.to_f
end

#on_base_plus_sluggingObject



100
101
102
# File 'lib/npb-api/stats/hitting.rb', line 100

def on_base_plus_slugging
  slugging_percentage + on_base_percentage
end

#playerObject



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

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

#runsObject



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

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

#runs_batted_inObject



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

def runs_batted_in
  @row.children[14].text.to_i
end

#sacrifice_fliesObject



64
65
66
# File 'lib/npb-api/stats/hitting.rb', line 64

def sacrifice_flies
  @row.children[18].text.to_i
end

#sacrifice_hitsObject



60
61
62
# File 'lib/npb-api/stats/hitting.rb', line 60

def sacrifice_hits
  @row.children[17].text.to_i
end

#slugging_percentageObject



92
93
94
# File 'lib/npb-api/stats/hitting.rb', line 92

def slugging_percentage
  @row.children[26].text.to_f
end

#stolen_basesObject



52
53
54
# File 'lib/npb-api/stats/hitting.rb', line 52

def stolen_bases
  @row.children[15].text.to_i
end

#strikeoutsObject



80
81
82
# File 'lib/npb-api/stats/hitting.rb', line 80

def strikeouts
  @row.children[23].text.to_i
end

#total_basesObject



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

def total_bases
  @row.children[13].text.to_i
end

#total_plate_appearancesObject



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

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

#tripleObject



36
37
38
# File 'lib/npb-api/stats/hitting.rb', line 36

def triple
  @row.children[10].text.to_i
end