Class: Booker::Parsers::Chrome

Inherits:
Base
  • Object
show all
Defined in:
lib/booker/parsers.rb

Overview

Chrome/Chromium bookmark parser (JSON format)

Instance Attribute Summary

Attributes inherited from Base

#allurls

Instance Method Summary collapse

Methods inherited from Base

#initialize, #results

Constructor Details

This class inherits a constructor from Booker::Parsers::Base

Instance Method Details

#parseObject



51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/booker/parsers.rb', line 51

def parse
  begin
    local_bookmarks = JSON.parse(File.read(@file_path))
    @chrome_bookmarks = local_bookmarks["roots"]["bookmark_bar"]["children"]
  rescue
    warn "Warning: ".yel + "Bookmarks file not found or invalid."
    warn "Suggest: ".grn + "booker --install bookmarks"
    return
  end

  parse_recursive
end