class Snapshotify::Document

Attributes

emitter[RW]
url[RW]

Public Class Methods

new(url, parent = nil) click to toggle source
# File lib/snapshotify/document.rb, line 8
def initialize url, parent = nil
  self.url = Snapshotify::Url.new(url, parent)
end

Public Instance Methods

data() click to toggle source
# File lib/snapshotify/document.rb, line 22
def data
  doc.to_xml
end
doc() click to toggle source
# File lib/snapshotify/document.rb, line 38
def doc
  @doc ||= begin
    html = HTTParty.get(url.canonical_url)
    Oga.parse_html(html)
  end
end
rewrite() click to toggle source
# File lib/snapshotify/document.rb, line 32
def rewrite
  rewriter = Snapshotify::Rewriter.new(self)
  rewriter.emitter = emitter
  rewriter.rewrite
end
write!() click to toggle source
# File lib/snapshotify/document.rb, line 26
def write!
  writer = Snapshotify::Writer.new(self)
  writer.emitter = emitter
  writer.write
end