Class: Pitcher
Constant Summary
Constants included from Helpers
Instance Attribute Summary collapse
-
#earned_runs ⇒ Object
readonly
Returns the value of attribute earned_runs.
-
#era ⇒ Object
readonly
Returns the value of attribute era.
-
#full_name ⇒ Object
readonly
Returns the value of attribute full_name.
-
#hits ⇒ Object
readonly
Returns the value of attribute hits.
-
#homeruns ⇒ Object
readonly
Returns the value of attribute homeruns.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#outs ⇒ Object
readonly
Returns the value of attribute outs.
-
#runs ⇒ Object
readonly
Returns the value of attribute runs.
-
#strikeouts ⇒ Object
readonly
Returns the value of attribute strikeouts.
-
#walks ⇒ Object
readonly
Returns the value of attribute walks.
Instance Method Summary collapse
-
#initialize(pitcher_xml) ⇒ Pitcher
constructor
A new instance of Pitcher.
- #ip ⇒ Object
Methods included from Helpers
#boxscore, #build_base_url, #generate_nokogiri_html, #generate_nokogiri_xml, #valid_game?
Constructor Details
#initialize(pitcher_xml) ⇒ Pitcher
Returns a new instance of Pitcher.
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/mlb_gd2/pitcher.rb', line 11 def initialize(pitcher_xml) @name = pitcher_xml.attribute("name").value @full_name = pitcher_xml.attribute("name_display_first_last").value @outs = pitcher_xml.attribute("out").value @walks = pitcher_xml.attribute("bb").value @strikeouts = pitcher_xml.attribute("so").value @hits = pitcher_xml.attribute("h").value @runs = pitcher_xml.attribute("r").value @homeruns = pitcher_xml.attribute("hr").value @earned_runs = pitcher_xml.attribute("er").value @era = pitcher_xml.attribute("era").value end |
Instance Attribute Details
#earned_runs ⇒ Object (readonly)
Returns the value of attribute earned_runs.
7 8 9 |
# File 'lib/mlb_gd2/pitcher.rb', line 7 def earned_runs @earned_runs end |
#era ⇒ Object (readonly)
Returns the value of attribute era.
7 8 9 |
# File 'lib/mlb_gd2/pitcher.rb', line 7 def era @era end |
#full_name ⇒ Object (readonly)
Returns the value of attribute full_name.
7 8 9 |
# File 'lib/mlb_gd2/pitcher.rb', line 7 def full_name @full_name end |
#hits ⇒ Object (readonly)
Returns the value of attribute hits.
7 8 9 |
# File 'lib/mlb_gd2/pitcher.rb', line 7 def hits @hits end |
#homeruns ⇒ Object (readonly)
Returns the value of attribute homeruns.
7 8 9 |
# File 'lib/mlb_gd2/pitcher.rb', line 7 def homeruns @homeruns end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/mlb_gd2/pitcher.rb', line 7 def name @name end |
#outs ⇒ Object (readonly)
Returns the value of attribute outs.
7 8 9 |
# File 'lib/mlb_gd2/pitcher.rb', line 7 def outs @outs end |
#runs ⇒ Object (readonly)
Returns the value of attribute runs.
7 8 9 |
# File 'lib/mlb_gd2/pitcher.rb', line 7 def runs @runs end |
#strikeouts ⇒ Object (readonly)
Returns the value of attribute strikeouts.
7 8 9 |
# File 'lib/mlb_gd2/pitcher.rb', line 7 def strikeouts @strikeouts end |
#walks ⇒ Object (readonly)
Returns the value of attribute walks.
7 8 9 |
# File 'lib/mlb_gd2/pitcher.rb', line 7 def walks @walks end |
Instance Method Details
#ip ⇒ Object
24 25 26 |
# File 'lib/mlb_gd2/pitcher.rb', line 24 def ip "#{(outs.to_i / 3).to_s}.#{outs.to_i%3}" end |