aboutsummaryrefslogtreecommitdiffstats
path: root/lib/rss/syndication.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rss/syndication.rb')
-rw-r--r--lib/rss/syndication.rb32
1 files changed, 12 insertions, 20 deletions
diff --git a/lib/rss/syndication.rb b/lib/rss/syndication.rb
index 8791ec24fc..3eb15429f6 100644
--- a/lib/rss/syndication.rb
+++ b/lib/rss/syndication.rb
@@ -15,20 +15,26 @@ module RSS
def self.append_features(klass)
super
-
- klass.module_eval(<<-EOC, *get_file_and_line_from_caller(1))
+
+ klass.install_must_call_validator(SY_PREFIX, SY_URI)
+ klass.module_eval do
[
["updatePeriod"],
["updateFrequency", :positive_integer]
].each do |name, type|
- install_text_element("\#{SY_PREFIX}_\#{name}", type,
- "\#{SY_PREFIX}:\#{name}")
+ install_text_element(name, SY_URI, "?",
+ "#{SY_PREFIX}_#{name}", type,
+ "#{SY_PREFIX}:#{name}")
end
%w(updateBase).each do |name|
- install_date_element("\#{SY_PREFIX}_\#{name}", 'w3cdtf', name)
+ install_date_element(name, SY_URI, "?",
+ "#{SY_PREFIX}_#{name}", 'w3cdtf',
+ "#{SY_PREFIX}:#{name}")
end
+ end
+ klass.module_eval(<<-EOC, __FILE__, __LINE__ + 1)
alias_method(:_sy_updatePeriod=, :sy_updatePeriod=)
def sy_updatePeriod=(new_value)
new_value = new_value.strip
@@ -38,20 +44,6 @@ module RSS
EOC
end
- def sy_validate(tags)
- counter = {}
- ELEMENTS.each do |name|
- counter[name] = 0
- end
-
- tags.each do |tag|
- key = "#{SY_PREFIX}_#{tag}"
- raise UnknownTagError.new(tag, SY_URI) unless counter.has_key?(key)
- counter[key] += 1
- raise TooMuchTagError.new(tag, tag_name) if counter[key] > 1
- end
- end
-
private
SY_UPDATEPERIOD_AVAILABLE_VALUES = %w(hourly daily weekly monthly yearly)
def validate_sy_updatePeriod(value)
@@ -69,7 +61,7 @@ module RSS
SyndicationModel::ELEMENTS.uniq!
SyndicationModel::ELEMENTS.each do |full_name|
name = full_name[prefix_size..-1]
- BaseListener.install_get_text_element(SY_URI, name, "#{full_name}=")
+ BaseListener.install_get_text_element(SY_URI, name, full_name)
end
end