Class: Yesradio::Item
- Inherits:
-
Object
- Object
- Yesradio::Item
- Defined in:
- lib/item.rb
Class Attribute Summary collapse
-
.elements ⇒ Object
Returns the value of attribute elements.
Instance Method Summary collapse
-
#initialize(element = nil) ⇒ Item
constructor
A new instance of Item.
Constructor Details
#initialize(element = nil) ⇒ Item
Returns a new instance of Item.
12 13 14 15 16 17 |
# File 'lib/item.rb', line 12 def initialize(element = nil) self.class.elements.each do |name, type| new_value = get_element_child element, name.gsub('_', '/'), type self.instance_variable_set("@#{name}", new_value) unless new_value.nil? end end |
Class Attribute Details
.elements ⇒ Object
Returns the value of attribute elements.
9 10 11 |
# File 'lib/item.rb', line 9 def elements @elements end |