class Pincerna::SafariBookmark
Show the list of Safari bookmarks.
Constants
- BOOKMARKS_DATA
The file with bookmarks data.
- ICON
The icon to show for each feedback item.
Public Instance Methods
read_bookmarks()
click to toggle source
Reads the list of Safari Bookmarks.
# File lib/pincerna/safari_bookmark.rb, line 17 def read_bookmarks data = execute_command("/usr/bin/plutil", "-convert", "xml1", "-o", "-", BOOKMARKS_DATA) if data && !data.empty? then Plist.parse_xml(data)["Children"].each do |children| scan_folder(children, "") 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/safari_bookmark.rb, line 32 def scan_folder(node, path) path += " #{SEPARATOR} #{node["Title"]}" (node["Children"] || []).each do |children| children["WebBookmarkType"] == "WebBookmarkTypeLeaf" ? add_bookmark(children["URIDictionary"]["title"], children["URLString"], path) : scan_folder(children, path) end end