Module: RSS::Maker::TaxonomyTopicsModel

Defined in:
lib/rss/maker/taxonomy.rb

Defined Under Namespace

Classes: TaxonomyTopicsBase

Class Method Summary (collapse)

Class Method Details

+ (Object) append_features(klass)



8
9
10
11
12
13
# File 'lib/rss/maker/taxonomy.rb', line 8

def self.append_features(klass)
  super

  klass.def_classed_element("#{RSS::TAXO_PREFIX}_topics",
                            "TaxonomyTopics")
end

+ (Object) install_taxo_topics(klass)



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/rss/maker/taxonomy.rb', line 15

def self.install_taxo_topics(klass)
  klass.module_eval(<<-EOC, __FILE__, __LINE__ + 1)
    class TaxonomyTopics < TaxonomyTopicsBase
      def to_feed(feed, current)
        if current.respond_to?(:taxo_topics)
          topics = current.class::TaxonomyTopics.new
          bag = topics.Bag
          @resources.each do |resource|
            bag.lis << RDF::Bag::Li.new(resource)
          end
          current.taxo_topics = topics
        end
      end
    end
EOC
end