Class: Butler::Dialog
- Inherits:
-
Object
show all
- Defined in:
- lib/butler/dialog.rb
Overview
A message can be converted to a dialog, this will open a query to the originator of the query and intercept every message there
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(plugin) ⇒ Dialog
Returns a new instance of Dialog.
30
31
32
33
34
35
36
37
38
39
40
41
|
# File 'lib/butler/dialog.rb', line 30
def initialize(plugin)
@plugin = plugin
@plugin.butler.subscribe(:PRIVMSG, 0, true) { |listener, message|
if message.private? then
postpone
dialog(listener, message)
:block
else
:pass
end
}
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(*args) ⇒ Object
60
61
62
|
# File 'lib/butler/dialog.rb', line 60
def method_missing(*args)
@plugin.__send__(*args)
end
|
Class Method Details
.reminder(after, string) ⇒ Object
25
26
27
|
# File 'lib/butler/dialog.rb', line 25
def reminder(after, string)
@reminder = after, string
end
|
.timeout(after, string) ⇒ Object
21
22
23
|
# File 'lib/butler/dialog.rb', line 21
def timeout(after, string)
@timeout = after, string
end
|
Instance Method Details
#dialog(listener, message) ⇒ Object
48
49
50
|
# File 'lib/butler/dialog.rb', line 48
def dialog(listener, message)
end
|
#localize(*args) ⇒ Object
Also known as:
_
55
56
57
|
# File 'lib/butler/dialog.rb', line 55
def localize(*args)
@plugin.localize(*args)
end
|
#postpone ⇒ Object
43
44
45
46
|
# File 'lib/butler/dialog.rb', line 43
def postpone
@reminder.postpone
@timeout.postpone
end
|
#timeout(timer, string) ⇒ Object
52
53
|
# File 'lib/butler/dialog.rb', line 52
def timeout(timer, string)
end
|