Class: SugarCube::ActionSheetDelegate
- Defined in:
- lib/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.
128 129 130 |
# File 'lib/sugarcube-factories/uiactionsheet.rb', line 128 def @buttons end |
#on_cancel ⇒ Object
Returns the value of attribute on_cancel.
130 131 132 |
# File 'lib/sugarcube-factories/uiactionsheet.rb', line 130 def on_cancel @on_cancel end |
#on_default ⇒ Object
Returns the value of attribute on_default.
129 130 131 |
# File 'lib/sugarcube-factories/uiactionsheet.rb', line 129 def on_default @on_default end |
#on_destructive ⇒ Object
Returns the value of attribute on_destructive.
131 132 133 |
# File 'lib/sugarcube-factories/uiactionsheet.rb', line 131 def on_destructive @on_destructive end |
#on_success ⇒ Object
Returns the value of attribute on_success.
132 133 134 |
# File 'lib/sugarcube-factories/uiactionsheet.rb', line 132 def on_success @on_success end |
Instance Method Details
#actionSheet(alert, didDismissWithButtonIndex: index) ⇒ Object
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 |
# File 'lib/sugarcube-factories/uiactionsheet.rb', line 134 def actionSheet(alert, didDismissWithButtonIndex:index) handler = nil if index == alert.destructiveButtonIndex && on_destructive handler = on_destructive || on_default elsif index == alert.cancelButtonIndex && on_cancel handler = on_cancel || on_default else handler = on_success || on_default end if handler if handler.arity == 0 handler.call elsif handler.arity == 1 = [index] handler.call() else = [index] handler.call(, index) end end self.send(:autorelease) end |