2004-10-31 09:14:21 -05:00
|
|
|
require 'rss/content'
|
|
|
|
require 'rss/maker/1.0'
|
|
|
|
|
|
|
|
module RSS
|
|
|
|
module Maker
|
|
|
|
module ContentModel
|
|
|
|
def self.append_features(klass)
|
|
|
|
super
|
|
|
|
|
|
|
|
::RSS::ContentModel::ELEMENTS.each do |element|
|
|
|
|
klass.add_need_initialize_variable(element)
|
|
|
|
klass.add_other_element(element)
|
|
|
|
klass.__send__(:attr_accessor, element)
|
|
|
|
klass.module_eval(<<-EOC, __FILE__, __LINE__)
|
|
|
|
def setup_#{element}(rss, current)
|
2004-11-03 01:43:18 -05:00
|
|
|
if #{element} and current.respond_to?(:#{element}=)
|
|
|
|
current.#{element} = @#{element} if @#{element}
|
|
|
|
end
|
2004-10-31 09:14:21 -05:00
|
|
|
end
|
2004-11-03 01:43:18 -05:00
|
|
|
EOC
|
2004-10-31 09:14:21 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2004-11-03 01:43:18 -05:00
|
|
|
class ItemsBase
|
|
|
|
class ItemBase; include ContentModel; end
|
2004-10-31 09:14:21 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|