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