Sha256: a1298b0214bbd51014bf22f8dc845c27d804f9f9a1c5a1252d36d5a7a8c706f4
Contents?: true
Size: 508 Bytes
Versions: 1
Compression:
Stored size: 508 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.content }.inject(:+) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
scrapzirra-0.0.3 | lib/scrapzirra/scrap.rb |