Class: Weechat::Hooks::CommandRun
- Inherits:
-
Weechat::Hook
- Object
- Weechat::Hook
- Weechat::Hooks::CommandRun
- Defined in:
- lib/weechat/hooks/command_run.rb
Instance Attribute Summary
Attributes inherited from Weechat::Hook
Attributes included from Pointer
Instance Method Summary collapse
-
#initialize(command, also_arguments = false, &callback) ⇒ CommandRun
constructor
Returns a new instance of CommandRunHook.
- #unhook(*args) ⇒ Object
Methods inherited from Weechat::Hook
#call, compute_free_id, find_by_id, #hooked?, hooks, inherited, init, register, unhook, unhook_all, unregister
Methods included from Pointer
Constructor Details
#initialize(command, also_arguments = false, &callback) ⇒ CommandRun
Returns a new instance of CommandRunHook
9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/weechat/hooks/command_run.rb', line 9 def initialize(command, also_arguments = false, &callback) super @command = if command.is_a? Command command.command else command.to_s end @callback = EvaluatedCallback.new(callback) @ptr = Weechat.hook_command_run(@command, "command_run_callback", id.to_s) if also_arguments @ptr2 = Weechat.hook_command_run("#@command *", "command_run_callback", id.to_s) end end |
Instance Method Details
#unhook(*args) ⇒ Object
24 25 26 27 |
# File 'lib/weechat/hooks/command_run.rb', line 24 def unhook(*args) super self.class.unhook(@ptr2) if @ptr2 end |