method
inherited
inherited(klass)
public
Hide source
# File lib/rss/rss.rb, line 448 def inherited(klass) klass.const_set("MUST_CALL_VALIDATORS", {}) klass.const_set("MODELS", []) klass.const_set("GET_ATTRIBUTES", []) klass.const_set("HAVE_CHILDREN_ELEMENTS", []) klass.const_set("TO_ELEMENT_METHODS", []) klass.const_set("NEED_INITIALIZE_VARIABLES", []) klass.const_set("PLURAL_FORMS", {}) klass.module_eval("public\n\n@tag_name = name.split(/::/).last\n@tag_name[0,1] = @tag_name[0,1].downcase\n@have_content = false\n\ndef self.must_call_validators\nsuper.merge(MUST_CALL_VALIDATORS)\nend\ndef self.models\nMODELS + super\nend\ndef self.get_attributes\nGET_ATTRIBUTES + super\nend\ndef self.have_children_elements\nHAVE_CHILDREN_ELEMENTS + super\nend\ndef self.to_element_methods\nTO_ELEMENT_METHODS + super\nend\ndef self.need_initialize_variables\nNEED_INITIALIZE_VARIABLES + super\nend\ndef self.plural_forms\nsuper.merge(PLURAL_FORMS)\nend\n\n\ndef self.install_must_call_validator(prefix, uri)\nMUST_CALL_VALIDATORS[uri] = prefix\nend\n\ndef self.install_model(tag, uri, occurs=nil, getter=nil)\ngetter ||= tag\nif m = MODELS.find {|t, u, o, g| t == tag and u == uri}\nm[2] = occurs\nelse\nMODELS << [tag, uri, occurs, getter]\nend\nend\n\ndef self.install_get_attribute(name, uri, required=true,\ntype=nil, disp_name=nil,\nelement_name=nil)\ndisp_name ||= name\nelement_name ||= name\ndef_corresponded_attr_writer name, type, disp_name\nconvert_attr_reader name\nif type == :boolean and /^is/ =~ name\nalias_method \"\\\#{$POSTMATCH}?\", name\nend\nGET_ATTRIBUTES << [name, uri, required, element_name]\nadd_need_initialize_variable(disp_name)\nend\n\ndef self.def_corresponded_attr_writer(name, type=nil, disp_name=name)\ncase type\nwhen :integer\ninteger_writer name, disp_name\nwhen :positive_integer\npositive_integer_writer name, disp_name\nwhen :boolean\nboolean_writer name, disp_name\nwhen :w3cdtf, :rfc822, :rfc2822\ndate_writer name, type, disp_name\nelse\nattr_writer name\nend\nend\n\ndef self.content_setup(type=nil)\ndef_corresponded_attr_writer \"content\", type\nconvert_attr_reader :content\n@have_content = true\nend\n\ndef self.have_content?\n@have_content\nend\n\ndef self.add_have_children_element(variable_name, plural_name)\nHAVE_CHILDREN_ELEMENTS << [variable_name, plural_name]\nend\n\ndef self.add_to_element_method(method_name)\nTO_ELEMENT_METHODS << method_name\nend\n\ndef self.add_need_initialize_variable(variable_name)\nNEED_INITIALIZE_VARIABLES << variable_name\nend\n\ndef self.add_plural_form(singular, plural)\nPLURAL_FORMS[singular] = plural\nend\n\n") end