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.



88
89
90
91
# File 'lib/wee/callback.rb', line 88

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.



86
87
88
# File 'lib/wee/callback.rb', line 86

def action_callbacks
  @action_callbacks
end

#input_callbacksObject (readonly)

Returns the value of attribute input_callbacks.



85
86
87
# File 'lib/wee/callback.rb', line 85

def input_callbacks
  @input_callbacks
end

Instance Method Details

#unregister(object) ⇒ Object



93
94
95
96
# File 'lib/wee/callback.rb', line 93

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

#with_triggered(ids_and_values) ⇒ Object



98
99
100
101
102
103
104
105
# File 'lib/wee/callback.rb', line 98

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