~ubuntu-branches/ubuntu/intrepid/ruby1.9/intrepid-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-05-21 14:00:19 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20070521140019-ui4zd0v80duktssk
Tags: 1.9.0+20070521-1
new upstream snapshot. (2006-07-21)  (Closes: #414856, #388344)

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
 
16
16
    def self.append_features(klass)
17
17
      super
18
 
      
19
 
      klass.module_eval(<<-EOC, *get_file_and_line_from_caller(1))
20
 
        %w(encoded).each do |name|
21
 
          install_text_element("\#{CONTENT_PREFIX}_\#{name}")
22
 
        end
23
 
      EOC
24
 
    end
25
 
 
26
 
    def content_validate(tags)
27
 
      counter = {}
28
 
      ELEMENTS.each do |name|
29
 
        counter[name] = 0
30
 
      end
31
 
 
32
 
      tags.each do |tag|
33
 
        key = "#{CONTENT_PREFIX}_#{tag}"
34
 
        raise UnknownTagError.new(tag, CONTENT_URI) unless counter.has_key?(key)
35
 
        counter[key] += 1
36
 
        raise TooMuchTagError.new(tag, tag_name) if counter[key] > 1
37
 
      end
38
 
    end
39
 
 
 
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
40
25
  end
41
26
 
42
27
  class RDF
47
32
  ContentModel::ELEMENTS.uniq!
48
33
  ContentModel::ELEMENTS.each do |full_name|
49
34
    name = full_name[prefix_size..-1]
50
 
    BaseListener.install_get_text_element(CONTENT_URI, name, "#{full_name}=")
 
35
    BaseListener.install_get_text_element(CONTENT_URI, name, full_name)
51
36
  end
52
37
 
53
38
end