class BookmarkMachine::NetscapeParser

Parser for the Netscape Bookmark File format. Amusingly, the best documentation for the format comes from Microsoft.

https://msdn.microsoft.com/en-us/library/aa753582(v=vs.85).aspx

We live in interesting times.

Public Class Methods

new(html) click to toggle source
# File lib/bookmark_machine/netscape_parser.rb, line 12
def initialize(html)
  @html = html
end

Public Instance Methods

bookmarks() click to toggle source

Returns an Array of Bookmark objects.

# File lib/bookmark_machine/netscape_parser.rb, line 17
def bookmarks
  @bookmarks ||= begin
    doc = BookmarkDocument.new
    parser = Nokogiri::HTML::SAX::Parser.new(doc)
    parser.parse(@html)
    
    doc.bookmarks
  end
end