123456789_123456789_123456789_123456789_123456789_

Module: RSS::ITunesModelUtils

Relationships & Source Files
Extension / Inclusion / Inheritance Descendants
Extended In:
Super Chains via Extension / Inclusion / Inheritance
Instance Chain:
self, Utils
Defined in: lib/rss/itunes.rb

Instance Method Summary

Utils - Included

#element_initialize_arguments?

This method is used inside of several different objects to determine if special behavior is needed in the constructor.

#get_file_and_line_from_caller

Returns an array of two elements: the filename where the calling method is located, and the line number where it is defined.

#h,
#html_escape

Takes a string s with some HTML in it, and escapes ‘&’, ‘“’, ‘<’ and ‘>’, by replacing them with the appropriate entities.

#new_with_value_if_need

If value is an instance of class klass, return it, else create a new instance of klass with value value.

#to_class_name

Given a name in a name_with_underscores or a name-with-dashes format, returns the CamelCase version of name.

Instance Method Details

#def_class_accessor(klass, name, type, *args)

[ GitHub ]

  
# 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)

[ GitHub ]

  
# 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)

[ GitHub ]

  
# 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