Sha256: 8048db0cb7c9d23eeef2631ffc4d8505bfb3af844392c92addcd4a5018bec492
Contents?: true
Size: 926 Bytes
Versions: 9
Compression:
Stored size: 926 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
9 entries across 9 versions & 1 rubygems