Class: Hitchart
- Inherits:
-
Object
- Object
- Hitchart
- Defined in:
- lib/hitchart.rb
Instance Attribute Summary collapse
-
#gid ⇒ Object
Returns the value of attribute gid.
-
#hips ⇒ Object
Returns the value of attribute hips.
Instance Method Summary collapse
-
#initialize ⇒ Hitchart
constructor
A new instance of Hitchart.
- #load_from_gid(gid) ⇒ Object
Constructor Details
#initialize ⇒ Hitchart
Returns a new instance of Hitchart.
8 9 10 |
# File 'lib/hitchart.rb', line 8 def initialize @hips = [] end |
Instance Attribute Details
#gid ⇒ Object
Returns the value of attribute gid.
5 6 7 |
# File 'lib/hitchart.rb', line 5 def gid @gid end |
#hips ⇒ Object
Returns the value of attribute hips.
5 6 7 |
# File 'lib/hitchart.rb', line 5 def hips @hips end |
Instance Method Details
#load_from_gid(gid) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/hitchart.rb', line 13 def load_from_gid(gid) @gid = gid @xml_data = GamedayFetcher.fetch_inning_hit(gid) @xml_doc = REXML::Document.new(@xml_data) if @xml_doc.root @xml_doc.elements.each("hitchart/hip") do |element| hip = Hip.new(element) @hips << hip end end end |