Module: RSS::SyndicationModel

Extended by:
BaseModel
Included in:
RDF::Channel
Defined in:
lib/rss/syndication.rb

Constant Summary collapse

ELEMENTS =
[]

Class Method Summary collapse

Methods included from BaseModel

install_date_element, install_have_child_element, install_have_children_element, install_text_element

Methods included from Utils

element_initialize_arguments?, get_file_and_line_from_caller, html_escape, new_with_value_if_need, to_class_name

Class Method Details

.append_features(klass) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/rss/syndication.rb', line 16

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