class Html2rss::ItemExtractors::Attribute
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.
Public Class Methods
new(xml, options)
click to toggle source
# File lib/html2rss/item_extractors/attribute.rb, line 25 def initialize(xml, options) @options = options @element = ItemExtractors.element(xml, options) end
Public Instance Methods
get()
click to toggle source
@return [String]
# File lib/html2rss/item_extractors/attribute.rb, line 32 def get @element.attr(@options[:attribute]).to_s end