Class: TVdb::Element
- Inherits:
-
OpenStruct
- Object
- OpenStruct
- TVdb::Element
- Defined in:
- lib/tvdb/element.rb
Direct Known Subclasses
Instance Method Summary collapse
-
#initialize(xml, root_name = nil) {|atts| ... } ⇒ Element
constructor
A new instance of Element.
Constructor Details
#initialize(xml, root_name = nil) {|atts| ... } ⇒ Element
Returns a new instance of Element.
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/tvdb/element.rb', line 3 def initialize(xml, root_name=nil) @root_name = root_name atts = attributes_from_xml(xml) # Downcase the keys atts = atts.inject({}){|, (k,v)| [k.downcase] = v; } # Don't mess with Object.id if atts.has_key?('id') sid = atts.delete('id') atts[:tvdb_id] = sid end yield(atts) if block_given? super(atts) end |