lib/html2rss/item.rb in html2rss-0.3.2 vs lib/html2rss/item.rb in html2rss-0.3.3
- old
+ new
@@ -24,14 +24,11 @@
extractor = attribute_config['extractor'] || 'text'
proc = ItemExtractor.const_get extractor.upcase.to_sym
value = proc.call(xml, attribute_config)
- post_process_options = attribute_config.fetch('post_process', false)
- value = post_process(value, post_process_options) if post_process_options
-
- value
+ post_process(value, attribute_config.fetch('post_process', false))
end
def available_attributes
@available_attributes ||= (%w[title link description author comments updated] &
@config.attribute_names) - ['categories']
@@ -57,12 +54,20 @@
end
end
private
- def post_process(value, options)
- Html2rss::AttributePostProcessors.get_processor(options)
+ def post_process(value, post_process_options = [])
+ return value unless post_process_options
+
+ post_process_options = [post_process_options] unless post_process_options.is_a?(Array)
+
+ post_process_options.each do |options|
+ value = AttributePostProcessors.get_processor(options)
.new(value, options, self)
.get
+ end
+
+ value
end
end
end