class Scraprr::ValueExtractor
Public Class Methods
new(attr, html)
click to toggle source
# File lib/scraprr/value_extractor.rb, line 3 def initialize(attr, html) @attr = attr @html = html end
Public Instance Methods
run(element)
click to toggle source
# File lib/scraprr/value_extractor.rb, line 8 def run(element) if @attr && element.first element.attr(@attr).to_s else if @html element.inner_html else element.inner_text end end end