/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

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