Class: Oga::HTML::Parser

Inherits:
XML::Parser
  • Object
show all
Defined in:
lib/oga/html/parser.rb

Overview

Parser for processing HTML input. This parser is a small wrapper around XML::Parser and takes care of setting the various options required for parsing HTML documents.

A basic example:

Oga::HTML::Parser.new('<meta charset="utf-8">').parse

Instance Method Summary collapse

Constructor Details

#initialize(data, options = {}) ⇒ Parser

Returns a new instance of Parser

Parameters:

  • data (String|IO)
  • options (Hash) (defaults to: {})

See Also:

  • Oga::HTML::Parser.[Oga[Oga::XML[Oga::XML::Parser[Oga::XML::Parser#initialize]

18
19
20
21
22
# File 'lib/oga/html/parser.rb', line 18

def initialize(data, options = {})
  options = options.merge(:html => true)

  super(data, options)
end