class Samao::Detail

Public Class Methods

new(params={}) { |self| ... } click to toggle source
# File lib/samao/detail.rb, line 5
def initialize(params={})
  matchable

  @item = params[:item]
  @url = params[:url]
  @baseurl = params[:baseurl]
  @catcher = Catcher.new(url:@url, baseurl: @baseurl)

  yield self if block_given?

  self
end

Public Instance Methods

run() click to toggle source
# File lib/samao/detail.rb, line 18
def run
  if @catcher and @catcher.run.success? and doc = @catcher.doc
    @selector.each do |name, sel|
      found(name, doc.css(sel), @item)
    end
  end

  self
end