Sha256: fb4387e0dc41e9c9ea216e4ce67b79d3d0e1d63354f7cc25884b18602c8e82f7

Contents?: true

Size: 411 Bytes

Versions: 7

Compression:

Stored size: 411 Bytes

Contents

module Notu

  module HtmlDocument

    def self.get(url, options = {})
      parse(HttpDownload.get(url, options))
    end

    def self.parse(data)
      data = data.gsub(/ /i, ' ').gsub(/\s+/, ' ')
      document = Nokogiri::HTML.parse(data, nil, 'UTF-8')
      raise ParseError.new('Invalid HTML document') if (document/'head').empty?
      document
    end
    private_class_method :parse

  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
notu-2.0.6 lib/notu/html_document.rb
notu-2.0.5 lib/notu/html_document.rb
notu-2.0.4 lib/notu/html_document.rb
notu-2.0.3 lib/notu/html_document.rb
notu-2.0.2 lib/notu/html_document.rb
notu-2.0.1 lib/notu/html_document.rb
notu-2.0.0 lib/notu/html_document.rb