class RubyMotionQuery::AlertAction

Constants

VALID_STYLES

Attributes

handler[R]
style[R]
tag[R]
title[R]

Public Class Methods

new(opts = {}, &block) click to toggle source
# File lib/project/alert_action.rb, line 11
def initialize(opts = {}, &block)
  opts     = {title: opts} if opts.is_a? String
  @title   = opts[:title] || "OK" || NSLocalizedString("OK", nil)
  @tag     = opts[:tag] || @title.gsub(/\s+/,"_").downcase.to_sym
  @style   = VALID_STYLES.include?(opts[:style]) ? opts[:style] : VALID_STYLES.first
  @handler = block if block_given?
end

Public Instance Methods

cancel?() click to toggle source
# File lib/project/alert_action.rb, line 27
def cancel?
  @style == :cancel
end
default?() click to toggle source
# File lib/project/alert_action.rb, line 19
def default?
  @style == :default
end
destructive?() click to toggle source
# File lib/project/alert_action.rb, line 23
def destructive?
  @style == :destructive
end