PageRenderTime 150ms CodeModel.GetById 144ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/tools/Ruby/lib/ruby/1.8/rss/maker/slash.rb

http://github.com/agross/netopenspace
Ruby | 33 lines | 29 code | 4 blank | 0 comment | 0 complexity | 9cf651fe519ec1b8b7b04ed36d25d6e1 MD5 | raw file
 1require 'rss/slash'
 2require 'rss/maker/1.0'
 3
 4module RSS
 5  module Maker
 6    module SlashModel
 7      def self.append_features(klass)
 8        super
 9
10        ::RSS::SlashModel::ELEMENT_INFOS.each do |name, type|
11          full_name = "#{RSS::SLASH_PREFIX}_#{name}"
12          case type
13          when :csv_integer
14            klass.def_csv_element(full_name, :integer)
15          else
16            klass.def_other_element(full_name)
17          end
18        end
19
20        klass.module_eval do
21          alias_method(:slash_hit_parades, :slash_hit_parade)
22          alias_method(:slash_hit_parades=, :slash_hit_parade=)
23        end
24      end
25    end
26
27    class ItemsBase
28      class ItemBase
29        include SlashModel
30      end
31    end
32  end
33end