Class: Jabber::Callback
- Inherits:
-
Object
- Object
- Jabber::Callback
- 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
-
#block ⇒ Object
readonly
The Callback’s block to execute.
-
#priority ⇒ Object
readonly
The Callback’s priority.
-
#ref ⇒ Object
readonly
The Callback’s reference, using for deleting purposes.
Instance Method Summary collapse
-
#initialize(priority = 0, ref = nil, block = Proc.new {}) ⇒ Callback
constructor
- Create a new callback priority
- Integer
-
the callback’s priority.
- #to_s ⇒ Object
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
#block ⇒ Object (readonly)
The Callback’s block to execute
116 117 118 |
# File 'lib/xmpp4r/callbacks.rb', line 116 def block @block end |
#priority ⇒ Object (readonly)
The Callback’s priority
110 111 112 |
# File 'lib/xmpp4r/callbacks.rb', line 110 def priority @priority end |
#ref ⇒ Object (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_s ⇒ Object
129 130 131 |
# File 'lib/xmpp4r/callbacks.rb', line 129 def to_s "#<#{[self.class, priority, ref].compact * " "}>" end |