In Files

  • rss/maker/base.rb

Class/Module Index [+]

Quicksearch

RSS::Maker::Base

Public Class Methods

append_features(klass) click to toggle source
 
               # 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
            
new(maker) click to toggle source
 
               # File rss/maker/base.rb, line 62
def initialize(maker)
  @maker = maker
  initialize_variables
end
            

Public Instance Methods

have_required_values?() click to toggle source
 
               # File rss/maker/base.rb, line 67
def have_required_values?
  true
end