Class: Alfred::Workflow

Inherits:
Object
  • Object
show all
Defined in:
lib/alfredlite/feedback.rb,
lib/alfredlite/workflow.rb

Constant Summary collapse

CACHE_DIR =
'/Library/Caches/com.runningwithcrayons.Alfred-2/Workflow Data'
DATA_DIR =
'/Library/Application Support/Alfred 2/Workflow Data'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(bundle_id) ⇒ Workflow

Returns a new instance of Workflow.



9
10
11
# File 'lib/alfredlite/workflow.rb', line 9

def initialize(bundle_id)
  @bundle_id = bundle_id
end

Instance Attribute Details

#bundle_idObject (readonly)

Returns the value of attribute bundle_id.



7
8
9
# File 'lib/alfredlite/workflow.rb', line 7

def bundle_id
  @bundle_id
end

Instance Method Details

#feedback_itemsObject



5
6
7
# File 'lib/alfredlite/feedback.rb', line 5

def feedback_items
  @feedback_items ||= []
end

#feedback_xmlObject



9
10
11
12
13
14
15
# File 'lib/alfredlite/feedback.rb', line 9

def feedback_xml
  doc = REXML::Document.new
  doc << REXML::Element.new('items')
  feedback_items.each { |item| doc.root << item.to_xml }

  doc
end

#query(input) ⇒ Object



25
26
# File 'lib/alfredlite/workflow.rb', line 25

def query(input)
end

#storage_pathObject



13
14
15
16
17
# File 'lib/alfredlite/workflow.rb', line 13

def storage_path
  @storage_path ||= File.join(ENV['HOME'], DATA_DIR, bundle_id)
  self.class.mkdir(@storage_path)
  @storage_path
end

#volatile_storage_pathObject



19
20
21
22
23
# File 'lib/alfredlite/workflow.rb', line 19

def volatile_storage_path
  @volatile_storage_path ||= File.join(ENV['HOME'], CACHE_DIR, bundle_id)
  self.class.mkdir(@volatile_storage_path)
  @volatile_storage_path
end