Class: Motion::Action

Inherits:
Object
  • Object
show all
Defined in:
lib/project/motion_action.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Action

Returns a new instance of Action.



5
6
7
8
9
# File 'lib/project/motion_action.rb', line 5

def initialize(options = {})
  self.title = options.fetch(:title, nil)
  self.action = options.fetch(:action, nil)
  self.style = options.fetch(:style, nil) || UIAlertActionStyleDefault
end

Instance Attribute Details

#actionObject

Returns the value of attribute action.



3
4
5
# File 'lib/project/motion_action.rb', line 3

def action
  @action
end

#styleObject

Returns the value of attribute style.



3
4
5
# File 'lib/project/motion_action.rb', line 3

def style
  @style
end

#titleObject

Returns the value of attribute title.



3
4
5
# File 'lib/project/motion_action.rb', line 3

def title
  @title
end

Instance Method Details

#chooseObject



11
12
13
14
15
# File 'lib/project/motion_action.rb', line 11

def choose
  if action != nil
    action.call
  end
end