Class: SugarCube::ActionSheetDelegate
- Defined in:
- lib/ios/sugarcube-factories/uiactionsheet.rb
Instance Attribute Summary collapse
-
#buttons ⇒ Object
Returns the value of attribute buttons.
-
#on_cancel ⇒ Object
Returns the value of attribute on_cancel.
-
#on_default ⇒ Object
Returns the value of attribute on_default.
-
#on_destructive ⇒ Object
Returns the value of attribute on_destructive.
-
#on_success ⇒ Object
Returns the value of attribute on_success.
Instance Method Summary collapse
Instance Attribute Details
#buttons ⇒ Object
Returns the value of attribute buttons.
154 155 156 |
# File 'lib/ios/sugarcube-factories/uiactionsheet.rb', line 154 def @buttons end |
#on_cancel ⇒ Object
Returns the value of attribute on_cancel.
156 157 158 |
# File 'lib/ios/sugarcube-factories/uiactionsheet.rb', line 156 def on_cancel @on_cancel end |
#on_default ⇒ Object
Returns the value of attribute on_default.
155 156 157 |
# File 'lib/ios/sugarcube-factories/uiactionsheet.rb', line 155 def on_default @on_default end |
#on_destructive ⇒ Object
Returns the value of attribute on_destructive.
157 158 159 |
# File 'lib/ios/sugarcube-factories/uiactionsheet.rb', line 157 def on_destructive @on_destructive end |
#on_success ⇒ Object
Returns the value of attribute on_success.
158 159 160 |
# File 'lib/ios/sugarcube-factories/uiactionsheet.rb', line 158 def on_success @on_success end |
Instance Method Details
#actionSheet(alert, didDismissWithButtonIndex: index) ⇒ Object
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 |
# File 'lib/ios/sugarcube-factories/uiactionsheet.rb', line 160 def actionSheet(alert, didDismissWithButtonIndex: index) handler = nil if index == alert.destructiveButtonIndex && on_destructive handler = on_destructive elsif index == alert.cancelButtonIndex && on_cancel handler = on_cancel elsif index != alert.destructiveButtonIndex && index != alert.cancelButtonIndex && on_success handler = on_success end handler ||= on_default if handler if handler.arity == 0 handler.call else = [index] if handler.arity == 1 handler.call() else handler.call(, index) end end end self.send(:autorelease) end |