summaryrefslogtreecommitdiff
path: root/lib/rss/maker/content.rb
blob: 67b237f4efd9b758a016b46abc49d079fffa9d8d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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)
              current.#{element} = @#{element} if @#{element}
            end
EOC
        end
      end
    end

    class RSS10
      class Items
        class Item; include ContentModel; end
      end
    end
  end
end