lib/html2rss/item_extractors.rb in html2rss-0.5.2 vs lib/html2rss/item_extractors.rb in html2rss-0.6.0

- old
+ new

@@ -10,14 +10,15 @@ # Provides a namespace for item extractors. module ItemExtractors DEFAULT = 'text'.freeze def self.get_extractor(name) - name ||= DEFAULT - camel_cased_name = name.split('_').map(&:capitalize).join - class_name = ['Html2rss', 'ItemExtractors', camel_cased_name].join('::') + @extractors = Hash.new do |hash, key| + camel_cased_name = key.split('_').map(&:capitalize).join + class_name = ['Html2rss', 'ItemExtractors', camel_cased_name].join('::') - Object.const_get(class_name) + hash[key] = Object.const_get(class_name) + end[name || DEFAULT] end ## # @return [Nokogiri::XML::Element] def self.element(xml, options)