Class: Emcee::Document
- Inherits:
-
Object
- Object
- Emcee::Document
- Defined in:
- lib/emcee/document.rb
Overview
Document is responsible for parsing HTML and handling interaction with the resulting document.
Instance Method Summary collapse
- #html_imports ⇒ Object
-
#initialize(data) ⇒ Document
constructor
A new instance of Document.
- #script_references ⇒ Object
- #style_references ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(data) ⇒ Document
Returns a new instance of Document.
8 9 10 |
# File 'lib/emcee/document.rb', line 8 def initialize(data) @doc = Nokogiri::HTML5.parse("<html><body>#{data}</body></html>") end |
Instance Method Details
#html_imports ⇒ Object
16 17 18 |
# File 'lib/emcee/document.rb', line 16 def html_imports wrap_nodes(@doc.css("link[rel='import']")) end |
#script_references ⇒ Object
20 21 22 |
# File 'lib/emcee/document.rb', line 20 def script_references wrap_nodes(@doc.css("script[src]")) end |
#style_references ⇒ Object
24 25 26 |
# File 'lib/emcee/document.rb', line 24 def style_references wrap_nodes(@doc.css("link[rel='stylesheet']")) end |
#to_s ⇒ Object
12 13 14 |
# File 'lib/emcee/document.rb', line 12 def to_s unescape(replace_html_with_xhtml) end |