Class: Jabber::Callback

Inherits:
Object
  • Object
show all
Defined in:
lib/xmpp4r/callbacks.rb

Overview

This class is used to store callbacks inside CallbackList. See the CallbackList class for more detailed explanations.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(priority = 0, ref = nil, block = Proc.new {}) ⇒ Callback

Create a new callback

priority
Integer

the callback’s priority. The higher, the sooner it

will be executed

ref
String

The callback’s reference



123
124
125
126
127
# File 'lib/xmpp4r/callbacks.rb', line 123

def initialize(priority = 0, ref = nil, block = Proc.new {})
  @priority = priority
  @ref = ref
  @block = block
end

Instance Attribute Details

#blockObject (readonly)

The Callback’s block to execute



116
117
118
# File 'lib/xmpp4r/callbacks.rb', line 116

def block
  @block
end

#priorityObject (readonly)

The Callback’s priority



110
111
112
# File 'lib/xmpp4r/callbacks.rb', line 110

def priority
  @priority
end

#refObject (readonly)

The Callback’s reference, using for deleting purposes



113
114
115
# File 'lib/xmpp4r/callbacks.rb', line 113

def ref
  @ref
end

Instance Method Details

#to_sObject



129
130
131
# File 'lib/xmpp4r/callbacks.rb', line 129

def to_s
  "#<#{[self.class, priority, ref].compact * " "}>"
end