Module: Weechat::Callbacks

Included in:
Bar::Item, Buffer
Defined in:
lib/weechat/callbacks.rb

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Class Attribute Details

.callbacksObject (readonly)

Returns the value of attribute callbacks



7
8
9
# File 'lib/weechat/callbacks.rb', line 7

def callbacks
  @callbacks
end

.unique_idObject (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_idObject



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

#callbacksObject



27
28
29
# File 'lib/weechat/callbacks.rb', line 27

def callbacks
  Callbacks.callbacks
end

#compute_free_idObject



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

#unique_idObject



31
32
33
# File 'lib/weechat/callbacks.rb', line 31

def unique_id
  Callbacks.unique_id
end