~ubuntu-branches/ubuntu/hardy/ruby1.8/hardy-updates

« back to all changes in this revision

Viewing changes to lib/rss/content.rb

  • Committer: Bazaar Package Importer
  • Author(s): akira yamada
  • Date: 2007-03-13 22:11:58 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20070313221158-h3oql37brlaf2go2
Tags: 1.8.6-1
* new upstream version, 1.8.6.
* libruby1.8 conflicts with libopenssl-ruby1.8 (< 1.8.6) (closes: #410018)
* changed packaging style to cdbs from dbs.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
require "rss/1.0"
 
2
 
 
3
module RSS
 
4
 
 
5
  CONTENT_PREFIX = 'content'
 
6
  CONTENT_URI = "http://purl.org/rss/1.0/modules/content/"
 
7
 
 
8
  RDF.install_ns(CONTENT_PREFIX, CONTENT_URI)
 
9
 
 
10
  module ContentModel
 
11
 
 
12
    extend BaseModel
 
13
 
 
14
    ELEMENTS = []
 
15
 
 
16
    def self.append_features(klass)
 
17
      super
 
18
 
 
19
      klass.install_must_call_validator(CONTENT_PREFIX, CONTENT_URI)
 
20
      %w(encoded).each do |name|
 
21
        klass.install_text_element(name, CONTENT_URI, "?",
 
22
                                   "#{CONTENT_PREFIX}_#{name}")
 
23
      end
 
24
    end
 
25
  end
 
26
 
 
27
  class RDF
 
28
    class Item; include ContentModel; end
 
29
  end
 
30
 
 
31
  prefix_size = CONTENT_PREFIX.size + 1
 
32
  ContentModel::ELEMENTS.uniq!
 
33
  ContentModel::ELEMENTS.each do |full_name|
 
34
    name = full_name[prefix_size..-1]
 
35
    BaseListener.install_get_text_element(CONTENT_URI, name, "#{full_name}=")
 
36
  end
 
37
 
 
38
end