diff options
author | Jari Vetoniemi <jari.vetoniemi@indooratlas.com> | 2020-03-16 18:49:26 +0900 |
---|---|---|
committer | Jari Vetoniemi <jari.vetoniemi@indooratlas.com> | 2020-03-30 00:39:06 +0900 |
commit | fcbf63e62c627deae76c1b8cb8c0876c536ed811 (patch) | |
tree | 64cb17de3f41a2b6fef2368028fbd00349946994 /jni/ruby/lib/rss/content.rb |
Fresh start
Diffstat (limited to 'jni/ruby/lib/rss/content.rb')
-rw-r--r-- | jni/ruby/lib/rss/content.rb | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/jni/ruby/lib/rss/content.rb b/jni/ruby/lib/rss/content.rb new file mode 100644 index 0000000..5a2120c --- /dev/null +++ b/jni/ruby/lib/rss/content.rb @@ -0,0 +1,33 @@ +require "rss/rss" + +module RSS + # The prefix for the Content XML namespace. + CONTENT_PREFIX = 'content' + # The URI of the Content specification. + CONTENT_URI = "http://purl.org/rss/1.0/modules/content/" + + module ContentModel + extend BaseModel + + ELEMENTS = ["#{CONTENT_PREFIX}_encoded"] + + def self.append_features(klass) + super + + klass.install_must_call_validator(CONTENT_PREFIX, CONTENT_URI) + ELEMENTS.each do |full_name| + name = full_name[(CONTENT_PREFIX.size + 1)..-1] + klass.install_text_element(name, CONTENT_URI, "?", full_name) + end + end + end + + prefix_size = CONTENT_PREFIX.size + 1 + ContentModel::ELEMENTS.each do |full_name| + name = full_name[prefix_size..-1] + BaseListener.install_get_text_element(CONTENT_URI, name, full_name) + end +end + +require 'rss/content/1.0' +require 'rss/content/2.0' |