Module: RSS::SlashModel

Extended by:
BaseModel
Included in:
RDF::Item
Defined in:
lib/rss/slash.rb

Constant Summary collapse

ELEMENT_INFOS =
[
 ["section"],
 ["department"],
 ["comments", :positive_integer],
 ["hit_parade", :csv_integer],
]

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



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/rss/slash.rb', line 21

def append_features(klass)
  super

  return if klass.instance_of?(Module)
  klass.install_must_call_validator(SLASH_PREFIX, SLASH_URI)
  ELEMENT_INFOS.each do |name, type, *additional_infos|
    full_name = "#{SLASH_PREFIX}_#{name}"
    klass.install_text_element(full_name, SLASH_URI, "?",
                               full_name, type, name)
  end

  klass.module_eval do
    alias_method(:slash_hit_parades, :slash_hit_parade)
    undef_method(:slash_hit_parade)
    alias_method(:slash_hit_parade, :slash_hit_parade_content)
  end
end