Class: SportsDataApi::Mlb::Venue

Inherits:
Object
  • Object
show all
Defined in:
lib/sports_data_api/mlb/venue.rb

Instance Method Summary collapse

Constructor Details

#initialize(xml) ⇒ Venue

Returns a new instance of Venue.



4
5
6
7
8
9
10
11
12
# File 'lib/sports_data_api/mlb/venue.rb', line 4

def initialize(xml)
  if xml.is_a? Nokogiri::XML::Element
    venue_ivar = self.instance_variable_set("@#{xml.name}", {})
    self.class.class_eval { attr_reader :"#{xml.name}" }
    xml.attributes.each do | attr_name, attr_value|
      venue_ivar[attr_name.to_sym] = attr_value.value
    end
  end
end