Flowdock
append_features(klass) public

No documentation

This method has no description. You can help the Ruby community by adding new notes.

Hide source
# File lib/rss/dublincore.rb, line 8
    def append_features(klass)
      super

      return if klass.instance_of?(Module)
      DublinCoreModel::ELEMENT_NAME_INFOS.each do |name, plural_name|
        plural = plural_name || "#{name}s"
        full_name = "#{DC_PREFIX}_#{name}"
        full_plural_name = "#{DC_PREFIX}_#{plural}"
        klass_name = "DublinCore#{Utils.to_class_name(name)}"
        klass.install_must_call_validator(DC_PREFIX, DC_URI)
        klass.install_have_children_element(name, DC_URI, "*",
                                            full_name, full_plural_name)
        klass.module_eval("remove_method :\#{full_name}\nremove_method :\#{full_name}=\nremove_method :set_\#{full_name}\n\ndef \#{full_name}\n@\#{full_name}.first and @\#{full_name}.first.value\nend\n\ndef \#{full_name}=(new_value)\n@\#{full_name}[0] = Utils.new_with_value_if_need(\#{klass_name}, new_value)\nend\nalias set_\#{full_name} \#{full_name}=\n", *get_file_and_line_from_caller(0))
      end
      klass.module_eval("if method_defined?(:date)\nalias date_without_\#{DC_PREFIX}_date= date=\n\ndef date=(value)\nself.date_without_\#{DC_PREFIX}_date = value\nself.\#{DC_PREFIX}_date = value\nend\nelse\nalias date \#{DC_PREFIX}_date\nalias date= \#{DC_PREFIX}_date=\nend\n\n# For backward compatibility\nalias \#{DC_PREFIX}_rightses \#{DC_PREFIX}_rights_list\n", *get_file_and_line_from_caller(0))
    end
Register or log in to add new notes.