Class: Alfred::Feedback::FileItem
- Defined in:
- lib/alfred/feedback/file_item.rb
Direct Known Subclasses
Constant Summary
Constants inherited from Item
Instance Attribute Summary
Attributes inherited from Item
#arg, #autocomplete, #icon, #order, #subtitle, #title, #type, #uid, #valid
Instance Method Summary collapse
-
#initialize(path, opts = {}) ⇒ FileItem
constructor
A new instance of FileItem.
Methods inherited from Item
#<=>, #all_title_match?, #always_match?, #match?, #title_match?, #to_xml
Constructor Details
#initialize(path, opts = {}) ⇒ FileItem
Returns a new instance of FileItem.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/alfred/feedback/file_item.rb', line 8 def initialize(path, opts = {}) if opts[:title] @title = opts[:title] elsif ['.ennote', '.webbookmark', '.vcf', '.abcdp', '.olk14Contact'].include? File.extname(path) @title = %x{/usr/bin/mdls -name kMDItemDisplayName -raw '#{path}'} else @title = File.basename(path) end @subtitle = path @uid = path @arg = path @icon = {:type => "fileicon", :name => path} @valid = 'yes' @autocomplete = @title @type = 'file' super @title, opts end |