Class: Markio::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/markio/parser.rb

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Parser

Returns a new instance of Parser.



6
7
8
# File 'lib/markio/parser.rb', line 6

def initialize data
  @document = Nokogiri::HTML data
end

Instance Method Details

#parseObject



10
11
12
13
14
15
16
# File 'lib/markio/parser.rb', line 10

def parse
  bookmarks = []
  traverse(@document, []) do |bookmark|
    bookmarks << bookmark
  end
  consolidate bookmarks
end