class Pincerna::ChromeBookmark
Show the list of Chrome bookmarks.
Constants
- BOOKMARKS_DATA
The location of the bookmarks data
- ICON
The icon to show for each feedback item.
Public Instance Methods
read_bookmarks()
click to toggle source
Reads the list of Chrome Bookmarks.
# File lib/pincerna/chrome_bookmark.rb, line 17 def read_bookmarks data = File.read(BOOKMARKS_DATA) rescue nil if data then Oj.load(data)["roots"].each do |_, root| scan_folder(root, "") if root.is_a?(Hash) end end end
Private Instance Methods
scan_folder(node, path)
click to toggle source
Scans a folder of bookmarks.
@param node [Hash] The directory to visit. @param path [String] The path of this node.
# File lib/pincerna/chrome_bookmark.rb, line 32 def scan_folder(node, path) path += " #{SEPARATOR} #{node["name"]}" node["children"].each do |children| children["type"] == "url" ? add_bookmark(children["name"], children["url"], path) : scan_folder(children, path) end end