module RSS::SetupMaker

Public Instance Methods

setup_maker(maker) click to toggle source
# File lib/rss/rss.rb, line 614
def setup_maker(maker)
  target = maker_target(maker)
  unless target.nil?
    setup_maker_attributes(target)
    setup_maker_element(target)
    setup_maker_elements(target)
  end
end

Private Instance Methods

maker_target(maker) click to toggle source
# File lib/rss/rss.rb, line 624
def maker_target(maker)
  nil
end
not_need_to_call_setup_maker_variables() click to toggle source
# File lib/rss/rss.rb, line 647
def not_need_to_call_setup_maker_variables
  []
end
setup_maker_attributes(target) click to toggle source
# File lib/rss/rss.rb, line 628
def setup_maker_attributes(target)
end
setup_maker_element(target) click to toggle source
# File lib/rss/rss.rb, line 631
def setup_maker_element(target)
  self.class.need_initialize_variables.each do |var|
    value = __send__(var)
    next if value.nil?
    if value.respond_to?("setup_maker") and
        !not_need_to_call_setup_maker_variables.include?(var)
      value.setup_maker(target)
    else
      setter = "#{var}="
      if target.respond_to?(setter)
        target.__send__(setter, value)
      end
    end
  end
end
setup_maker_elements(parent) click to toggle source
# File lib/rss/rss.rb, line 651
def setup_maker_elements(parent)
  self.class.have_children_elements.each do |name, plural_name|
    if parent.respond_to?(plural_name)
      target = parent.__send__(plural_name)
      __send__(plural_name).each do |elem|
        elem.setup_maker(target)
      end
    end
  end
end