Sha256: 337f5a57d5b14676d0b95c2713c56b18962fa89b4f46e4d388e993df15b35b86
Contents?: true
Size: 925 Bytes
Versions: 2
Compression:
Stored size: 925 Bytes
Contents
module Html2rss module ItemExtractors ## # Returns the value of the attribute. # # Imagine this +time+ HTML element with a +datetime+ attribute: # # <time datetime="2019-07-01">...</time> # # YAML usage example: # # selectors: # link: # selector: time # extractor: attribute # attribute: datetime # # Would return: # '2019-07-01' # # In case you're extracting a date or a time, do not forget to parse it # during post processing with # {AttributePostProcessors::ParseTime}[rdoc-ref:Html2rss::AttributePostProcessors::ParseTime]. class Attribute def initialize(xml, options) @options = options @element = ItemExtractors.element(xml, options) end ## # @return [String] def get @element.attr(@options[:attribute]).to_s end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
html2rss-0.9.0 | lib/html2rss/item_extractors/attribute.rb |
html2rss-0.8.2 | lib/html2rss/item_extractors/attribute.rb |