Class: Homerun
Constant Summary
Constants included from Helpers
Instance Attribute Summary collapse
-
#horizontal_angle ⇒ Object
readonly
Returns the value of attribute horizontal_angle.
-
#true_distance ⇒ Object
readonly
Returns the value of attribute true_distance.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(homerun_nokogiri_row) ⇒ Homerun
constructor
A new instance of Homerun.
Methods included from Helpers
build_base_url, generate_nokogiri_html
Constructor Details
#initialize(homerun_nokogiri_row) ⇒ Homerun
Returns a new instance of Homerun.
10 11 12 13 |
# File 'lib/yabo_tracker/homerun.rb', line 10 def initialize(homerun_nokogiri_row) @horizontal_angle = homerun_nokogiri_row.search('td:nth-of-type(14) span').text.to_f @true_distance = homerun_nokogiri_row.search('td:nth-of-type(19) span').text.to_i end |
Instance Attribute Details
#horizontal_angle ⇒ Object (readonly)
Returns the value of attribute horizontal_angle.
6 7 8 |
# File 'lib/yabo_tracker/homerun.rb', line 6 def horizontal_angle @horizontal_angle end |
#true_distance ⇒ Object (readonly)
Returns the value of attribute true_distance.
6 7 8 |
# File 'lib/yabo_tracker/homerun.rb', line 6 def true_distance @true_distance end |
Class Method Details
.homers_for_id(id) ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/yabo_tracker/homerun.rb', line 15 def self.homers_for_id(id) html = Helpers.generate_nokogiri_html(Helpers.build_base_url(id)) rows = html.search('table.forumline:last-of-type tr')[4..-1] rows.map do |row| Homerun.new(row) end end |