Class: Alfred::Handler::Base
- Inherits:
-
Object
- Object
- Alfred::Handler::Base
show all
- Defined in:
- lib/alfred/handler.rb
Constant Summary
collapse
- Base_Invoke_Order =
100
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(alfred, opts = {}) ⇒ Base
Returns a new instance of Base.
14
15
16
17
18
|
# File 'lib/alfred/handler.rb', line 14
def initialize(alfred, opts = {})
@core = alfred
@order = Base_Invoke_Order
@status = :initialize
end
|
Instance Attribute Details
#order ⇒ Object
Returns the value of attribute order.
12
13
14
|
# File 'lib/alfred/handler.rb', line 12
def order
@order
end
|
#status ⇒ Object
Returns the value of attribute status.
12
13
14
|
# File 'lib/alfred/handler.rb', line 12
def status
@status
end
|
Instance Method Details
#<=>(other) ⇒ Object
52
53
54
|
# File 'lib/alfred/handler.rb', line 52
def <=>(other)
order <=> other.order
end
|
#action?(arg) ⇒ Boolean
36
37
38
|
# File 'lib/alfred/handler.rb', line 36
def action?(arg)
arg.is_a?(Hash) && arg[:handler].eql?(@settings[:handler])
end
|
#feedback ⇒ Object
87
88
89
|
# File 'lib/alfred/handler.rb', line 87
def feedback
@core.feedback
end
|
#feedback? ⇒ Boolean
29
30
31
|
# File 'lib/alfred/handler.rb', line 29
def feedback?
true
end
|
#on_action(arg) ⇒ Object
40
41
42
|
# File 'lib/alfred/handler.rb', line 40
def on_action(arg)
;
end
|
#on_close ⇒ Object
44
45
46
|
# File 'lib/alfred/handler.rb', line 44
def on_close
;
end
|
#on_feedback ⇒ Object
32
33
34
|
# File 'lib/alfred/handler.rb', line 32
def on_feedback
raise NotImplementedError
end
|
#on_help ⇒ Object
25
26
27
|
# File 'lib/alfred/handler.rb', line 25
def on_help
[]
end
|
#on_parser ⇒ Object
21
22
23
|
# File 'lib/alfred/handler.rb', line 21
def on_parser
;
end
|
#options ⇒ Object
71
72
73
|
# File 'lib/alfred/handler.rb', line 71
def options
@core.options
end
|
#parser ⇒ Object
75
76
77
|
# File 'lib/alfred/handler.rb', line 75
def parser
@core.query_parser
end
|
#query ⇒ Object
79
80
81
|
# File 'lib/alfred/handler.rb', line 79
def query
@core.query
end
|
#register ⇒ Object
48
49
50
|
# File 'lib/alfred/handler.rb', line 48
def register
@core.handler_controller.register(self)
end
|
#status_message(text, exitstatus) ⇒ Object
57
58
59
60
61
62
63
|
# File 'lib/alfred/handler.rb', line 57
def status_message(text, exitstatus)
if exitstatus == 0
return "⭕ #{text}"
else
return "❌ #{text}"
end
end
|
#ui ⇒ Object
83
84
85
|
# File 'lib/alfred/handler.rb', line 83
def ui
@core.ui
end
|
#xml_builder(arg) ⇒ Object
67
68
69
|
# File 'lib/alfred/handler.rb', line 67
def xml_builder(arg)
@core.xml_builder(arg)
end
|