Class: Wee::Callbacks

Inherits:
Object show all
Defined in:
lib/wee/callback.rb

Overview

class CallbackRegistry

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeCallbacks

Returns a new instance of Callbacks.



67
68
69
70
# File 'lib/wee/callback.rb', line 67

def initialize
  @input_callbacks = CallbackRegistry.new("")
  @action_callbacks = CallbackRegistry.new("a")
end

Instance Attribute Details

#action_callbacksObject (readonly)

Returns the value of attribute action_callbacks.



65
66
67
# File 'lib/wee/callback.rb', line 65

def action_callbacks
  @action_callbacks
end

#input_callbacksObject (readonly)

Returns the value of attribute input_callbacks.



64
65
66
# File 'lib/wee/callback.rb', line 64

def input_callbacks
  @input_callbacks
end

Instance Method Details

#unregister(object) ⇒ Object



72
73
74
75
# File 'lib/wee/callback.rb', line 72

def unregister(object)
  @input_callbacks.unregister(object)
  @action_callbacks.unregister(object)
end

#with_triggered(ids_and_values) ⇒ Object



77
78
79
80
81
82
83
84
# File 'lib/wee/callback.rb', line 77

def with_triggered(ids_and_values)
  @input_callbacks.prepare_triggered(ids_and_values)
  @action_callbacks.prepare_triggered(ids_and_values)
  yield
ensure
  @input_callbacks.reset_triggered
  @action_callbacks.reset_triggered
end