Module: Weechat::Callbacks
Class Attribute Summary collapse
-
.callbacks ⇒ Object
readonly
Returns the value of attribute callbacks.
-
.unique_id ⇒ Object
readonly
Returns the value of attribute unique_id.
Class Method Summary collapse
Instance Method Summary collapse
- #call_callback(id, type, *args) ⇒ Object
- #callbacks ⇒ Object
- #compute_free_id ⇒ Object
- #register_callback(args = {}) ⇒ Object
- #unique_id ⇒ Object
Class Attribute Details
.callbacks ⇒ Object (readonly)
Returns the value of attribute callbacks.
7 8 9 |
# File 'lib/weechat/callbacks.rb', line 7 def callbacks @callbacks end |
.unique_id ⇒ Object (readonly)
Returns the value of attribute unique_id.
8 9 10 |
# File 'lib/weechat/callbacks.rb', line 8 def unique_id @unique_id end |
Class Method Details
.compute_free_id ⇒ Object
10 11 12 |
# File 'lib/weechat/callbacks.rb', line 10 def compute_free_id @unique_id += 1 end |
Instance Method Details
#call_callback(id, type, *args) ⇒ Object
15 16 17 |
# File 'lib/weechat/callbacks.rb', line 15 def call_callback(id, type, *args) return callbacks[id.to_i][type].call(*args) end |
#callbacks ⇒ Object
27 28 29 |
# File 'lib/weechat/callbacks.rb', line 27 def callbacks Callbacks.callbacks end |
#compute_free_id ⇒ Object
23 24 25 |
# File 'lib/weechat/callbacks.rb', line 23 def compute_free_id Callbacks.compute_free_id end |
#register_callback(args = {}) ⇒ Object
19 20 21 |
# File 'lib/weechat/callbacks.rb', line 19 def register_callback(args = {}) callbacks[unique_id] = args end |