Module: RSS::ITunesModelUtils
- Includes:
- Utils
- Included in:
- ITunesBaseModel, ITunesChannelModel, ITunesItemModel
- Defined in:
- lib/rss/itunes.rb
Instance Method Summary collapse
- #def_class_accessor(klass, name, type, *args) ⇒ Object
- #def_element_class_accessor(klass, name, full_name, klass_name, recommended_attribute_name = nil) ⇒ Object
- #def_elements_class_accessor(klass, name, full_name, klass_name, plural_name, recommended_attribute_name = nil) ⇒ Object
Methods included from Utils
element_initialize_arguments?, get_file_and_line_from_caller, new_with_value_if_need, to_class_name
Instance Method Details
#def_class_accessor(klass, name, type, *args) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/rss/itunes.rb', line 15 def def_class_accessor(klass, name, type, *args) normalized_name = name.gsub(/-/, "_") full_name = "#{ITUNES_PREFIX}_#{normalized_name}" klass_name = "ITunes#{Utils.to_class_name(normalized_name)}" case type when :element, :attribute klass::ELEMENTS << full_name def_element_class_accessor(klass, name, full_name, klass_name, *args) when :elements klass::ELEMENTS << full_name def_elements_class_accessor(klass, name, full_name, klass_name, *args) else klass.install_must_call_validator(ITUNES_PREFIX, ITUNES_URI) klass.install_text_element(normalized_name, ITUNES_URI, "?", full_name, type, name) end end |
#def_element_class_accessor(klass, name, full_name, klass_name, recommended_attribute_name = nil) ⇒ Object
34 35 36 37 |
# File 'lib/rss/itunes.rb', line 34 def def_element_class_accessor(klass, name, full_name, klass_name, recommended_attribute_name=nil) klass.install_have_child_element(name, ITUNES_PREFIX, "?", full_name) end |
#def_elements_class_accessor(klass, name, full_name, klass_name, plural_name, recommended_attribute_name = nil) ⇒ Object
39 40 41 42 43 44 |
# File 'lib/rss/itunes.rb', line 39 def def_elements_class_accessor(klass, name, full_name, klass_name, plural_name, recommended_attribute_name=nil) full_plural_name = "#{ITUNES_PREFIX}_#{plural_name}" klass.install_have_children_element(name, ITUNES_PREFIX, "*", full_name, full_plural_name) end |