Sha256: d2afe3621e896c41ae793dc66cfe68cfec061e13d2d3ed65cd2cf71dae7d2004
Contents?: true
Size: 511 Bytes
Versions: 1
Compression:
Stored size: 511 Bytes
Contents
module Scrapzirra class Scrap attr_accessor :url def initialize url, options = {} @url = url @doc = Nokogiri::HTML(options[:doc]) if options[:doc] end def doc @doc || load_doc end def load_doc require 'nokogiri' require 'open-uri' @doc = Nokogiri::HTML(open(@url)) rescue @doc = Nokogiri::HTML::Document.parse('No data') end def selector_content css doc.css(css).collect{|a| a.inner_html }.inject(:+) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
scrapzirra-0.0.4 | lib/scrapzirra/scrap.rb |