summaryrefslogtreecommitdiff
path: root/lib/rss/taxonomy.rb
blob: 5d3dd5bf85fe34a924605e30b870a38cc0ccaf39 (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
30
31
32
# Experimental

require "rss/1.0"

module RSS

	TAXO_PREFIX = "taxo"
	TAXO_NS = "http://purl.org/rss/1.0/modules/taxonomy/"

	Element.install_ns(TAXO_PREFIX, TAXO_NS)

	TAXO_ELEMENTS = []

	%w(link).each do |x|
		if const_defined? :Listener
			Listener.install_get_text_element(x, TAXO_NS, "#{TAXO_PREFIX}_#{x}=")
		end
		TAXO_ELEMENTS << "#{TAXO_PREFIX}_#{x}"
	end
		
	module TaxonomyModel
		attr_writer *%w(title description creator subject publisher
		                contributor date format identifier source
		                language relation coverage rights).collect{|x| "#{TAXO_PREFIX}_#{x}"}
	end
	
	class Channel; extend TaxonomyModel;	end
	class Item; extend TaxonomyModel;	end
	class Image; extend TaxonomyModel;	end
	class TextInput; extend TaxonomyModel;	end
	
end