Class: Pincerna::Bookmark
Overview
Show the list of Safari bookmarks.
Direct Known Subclasses
Constant Summary
- MATCHER =
The expression to match.
/^(?<all>.*)$/i
- ICON =
The icon to show for each feedback item.
Pincerna::Base::ROOT + "/images/safari.png"
- SEPARATOR =
The separator for paths.
"\u2192"
Constants inherited from Base
Pincerna::Base::CACHE_ROOT, Pincerna::Base::FULL_NAME, Pincerna::Base::RELEVANT_MATCHES, Pincerna::Base::ROOT, Pincerna::Base::TYPES, Pincerna::Base::WORKFLOW_ROOT
Instance Attribute Summary
Attributes inherited from Base
#format, #format_content_type, #output
Instance Method Summary (collapse)
-
- (Array) perform_filtering(query)
Reads the list of Chrome Bookmarks.
-
- (Array) process_results(results)
Processes items to obtain feedback items.
-
- (Object) read_bookmarks
Reads the list of bookmarks.
Methods inherited from Base
#add_feedback_item, execute!, #filter, #format_float, #initialize, #output_feedback, #round_float
Constructor Details
This class inherits a constructor from Pincerna::Base
Instance Method Details
- (Array) perform_filtering(query)
Reads the list of Chrome Bookmarks.
23 24 25 26 27 28 29 30 |
# File 'lib/pincerna/bookmark.rb', line 23 def perform_filtering(query) Pincerna::Cache.instance.use("bookmarks:#{self.class.to_s}", Pincerna::Cache::EXPIRATIONS[:short]) do # Get bookmarks and then only keep valid ones @bookmarks = [] read_bookmarks filter_and_sort(@bookmarks, query) end end |
- (Array) process_results(results)
Processes items to obtain feedback items.
36 37 38 39 40 41 |
# File 'lib/pincerna/bookmark.rb', line 36 def process_results(results) results.map do |result| subtitle = result[:path] ? result[:path].gsub(/^\s\u2192 /, "") : "Action this item to open the URL in the browser ..." {title: result[:name], arg: result[:url], subtitle: subtitle, icon: ICON} end end |
- (Object) read_bookmarks
Reads the list of bookmarks.
44 45 46 |
# File 'lib/pincerna/bookmark.rb', line 44 def read_bookmarks raise ArgumentError.new("Must be overriden by subclasses.") end |