Class: SugarCube::UIControlCallbackHelper
- Defined in:
- lib/ios/sugarcube-events/uicontrol.rb
Instance Method Summary collapse
- #call(sender, event: event) ⇒ Object
-
#initialize(callback) ⇒ UIControlCallbackHelper
constructor
A new instance of UIControlCallbackHelper.
Constructor Details
#initialize(callback) ⇒ UIControlCallbackHelper
Returns a new instance of UIControlCallbackHelper.
84 85 86 |
# File 'lib/ios/sugarcube-events/uicontrol.rb', line 84 def initialize(callback) @callback = callback.respond_to?('weak!') ? callback.weak! : callback end |
Instance Method Details
#call(sender, event: event) ⇒ Object
88 89 90 91 92 93 94 95 96 97 |
# File 'lib/ios/sugarcube-events/uicontrol.rb', line 88 def call(sender, event:event) case @callback.arity when 0 @callback.call when 1 @callback.call(sender) else @callback.call(sender, event) end end |