123456789_123456789_123456789_123456789_123456789_

Module: RSS::SyndicationModel

Relationships & Source Files
Extension / Inclusion / Inheritance Descendants
Included In:
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, BaseModel, Utils
Defined in: lib/rss/syndication.rb

Constant Summary

Class Method Summary

BaseModel - Extended

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 Summary

Class Method Details

.append_features(klass)

[ GitHub ]

  
# File 'lib/rss/syndication.rb', line 17

def self.append_features(klass)
  super

  klass.install_must_call_validator(SY_PREFIX, SY_URI)
  klass.module_eval do
    [
      ["updatePeriod"],
      ["updateFrequency", :positive_integer]
    ].each do |name, type|
      install_text_element(name, SY_URI, "?",
                           "#{SY_PREFIX}_#{name}", type,
                           "#{SY_PREFIX}:#{name}")
    end

    %w(updateBase).each do |name|
      install_date_element(name, SY_URI, "?",
                           "#{SY_PREFIX}_#{name}", 'w3cdtf',
                           "#{SY_PREFIX}:#{name}")
    end
  end

  klass.module_eval(<<-EOC, __FILE__, __LINE__ + 1)
    alias_method(:_sy_updatePeriod=, :sy_updatePeriod=)
    def sy_updatePeriod=(new_value)
      new_value = new_value.strip
      validate_sy_updatePeriod(new_value) if @do_validate
      self._sy_updatePeriod = new_value
    end
  EOC
end

Instance Method Details

#validate_sy_updatePeriod(value) (private)

[ GitHub ]

  
# File 'lib/rss/syndication.rb', line 50

def validate_sy_updatePeriod(value)
  unless SY_UPDATEPERIOD_AVAILABLE_VALUES.include?(value)
    raise NotAvailableValueError.new("updatePeriod", value)
  end
end