From fcbf63e62c627deae76c1b8cb8c0876c536ed811 Mon Sep 17 00:00:00 2001 From: Jari Vetoniemi Date: Mon, 16 Mar 2020 18:49:26 +0900 Subject: Fresh start --- jni/ruby/lib/rss/content.rb | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 jni/ruby/lib/rss/content.rb (limited to 'jni/ruby/lib/rss/content.rb') 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' -- cgit v1.2.3