Class: Markio::Parser
- Inherits:
-
Object
- Object
- Markio::Parser
- Defined in:
- lib/markio/parser.rb
Instance Method Summary collapse
-
#initialize(file) ⇒ Parser
constructor
A new instance of Parser.
- #parse ⇒ Object
Constructor Details
#initialize(file) ⇒ Parser
Returns a new instance of Parser.
5 6 7 8 |
# File 'lib/markio/parser.rb', line 5 def initialize(file) file = File.open(file) unless file.is_a? File @document = Nokogiri::HTML(file) end |
Instance Method Details
#parse ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/markio/parser.rb', line 10 def parse bookmarks = [] traverse(@document, []) do |bookmark| bookmarks << bookmark end bookmarks end |