method
append_features
Ruby latest stable (v2_5_5)
-
0 notes -
Class: RSS::Maker::Base
- 1_8_6_287 (0)
- 1_8_7_72
- 1_8_7_330
- 1_9_1_378
- 1_9_2_180
- 1_9_3_125
- 1_9_3_392
- 2_1_10
- 2_2_9
- 2_4_6
- 2_5_5
- 2_6_3
- What's this?
append_features(klass)
public
Hide source
# File lib/rss/maker/base.rb, line 10 def self.append_features(klass) super klass.module_eval("\nOTHER_ELEMENTS = []\nNEED_INITIALIZE_VARIABLES = []\n\ndef self.inherited(subclass)\nsubclass.const_set(\"OTHER_ELEMENTS\", [])\nsubclass.const_set(\"NEED_INITIALIZE_VARIABLES\", [])\n\nsubclass.module_eval(<<-EOEOC, __FILE__, __LINE__)\ndef self.other_elements\nOTHER_ELEMENTS + super\nend\n\ndef self.need_initialize_variables\nNEED_INITIALIZE_VARIABLES + super\nend\nEOEOC\nend\n\ndef self.add_other_element(variable_name)\nOTHER_ELEMENTS << variable_name\nend\n\ndef self.other_elements\nOTHER_ELEMENTS\nend\n\ndef self.add_need_initialize_variable(variable_name, init_value=\"nil\")\nNEED_INITIALIZE_VARIABLES << [variable_name, init_value]\nend\n\ndef self.need_initialize_variables\nNEED_INITIALIZE_VARIABLES\nend\n\ndef self.def_array_element(name)\ninclude Enumerable\nextend Forwardable\n\ndef_delegators(\"@\\\#{name}\", :<<, :[], :[]=, :first, :last)\ndef_delegators(\"@\\\#{name}\", :push, :pop, :shift, :unshift)\ndef_delegators(\"@\\\#{name}\", :each, :size)\n\nadd_need_initialize_variable(name, \"[]\")\nend\n", __FILE__, __LINE__) end