# File rss/maker/base.rb, line 10
def self.append_features(klass)
super
klass.module_eval("
OTHER_ELEMENTS = []
NEED_INITIALIZE_VARIABLES = []
def self.inherited(subclass)
subclass.const_set("OTHER_ELEMENTS", [])
subclass.const_set("NEED_INITIALIZE_VARIABLES", [])
subclass.module_eval(<<-EOEOC, __FILE__, __LINE__)
def self.other_elements
OTHER_ELEMENTS + super
end
def self.need_initialize_variables
NEED_INITIALIZE_VARIABLES + super
end
EOEOC
end
def self.add_other_element(variable_name)
OTHER_ELEMENTS << variable_name
end
def self.other_elements
OTHER_ELEMENTS
end
def self.add_need_initialize_variable(variable_name, init_value="nil")
NEED_INITIALIZE_VARIABLES << [variable_name, init_value]
end
def self.need_initialize_variables
NEED_INITIALIZE_VARIABLES
end
def self.def_array_element(name)
include Enumerable
extend Forwardable
def_delegators("@\#{name}", :<<, :[], :[]=, :first, :last)
def_delegators("@\#{name}", :push, :pop, :shift, :unshift)
def_delegators("@\#{name}", :each, :size)
add_need_initialize_variable(name, "[]")
end
", __FILE__, __LINE__)
end
Commenting is here to help enhance the documentation. For example, code samples, or clarification of the documentation.
If you have questions about Ruby or the documentation, please post to one of the Ruby mailing lists. You will get better, faster, help that way.
If you wish to post a correction of the docs, please do so, but also file bug report so that it can be corrected for the next release. Thank you.
If you want to help improve the Ruby documentation, please see Improve the docs, or visit Documenting-ruby.org.