Class: Callback

Inherits:
Object
  • Object
show all
Defined in:
lib/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



117
118
119
120
121
# File 'lib/callbacks.rb', line 117

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



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

def block
  @block
end

#priorityObject (readonly)

The Callback’s priority



104
105
106
# File 'lib/callbacks.rb', line 104

def priority
  @priority
end

#refObject (readonly)

The Callback’s reference, using for deleting purposes



107
108
109
# File 'lib/callbacks.rb', line 107

def ref
  @ref
end