Class: ButtonRow

Inherits:
TextInputRow show all
Defined in:
lib/project/rows/button_row.rb

Constant Summary

Constants inherited from TextInputRow

TextInputRow::EMAIL_REGEX, TextInputRow::URL_REGEX

Instance Attribute Summary collapse

Attributes inherited from TextInputRow

#value

Attributes inherited from BaseRow

#key, #label, #options

Instance Method Summary collapse

Methods inherited from TextInputRow

#capitalize?, #did_end_editing, #setup_validation, #valid?, #validation_rules

Methods inherited from BaseRow

#cell_identifier, #dealloc, #has_value?, #notification_center, #observe, #post

Constructor Details

#initialize(key, options) ⇒ ButtonRow

Returns a new instance of ButtonRow.



7
8
9
10
11
# File 'lib/project/rows/button_row.rb', line 7

def initialize(key, options)
  super

  @on_tap_callback = options.fetch(:action, lambda {})
end

Instance Attribute Details

#on_tap_callbackObject (readonly)

Returns the value of attribute on_tap_callback.



5
6
7
# File 'lib/project/rows/button_row.rb', line 5

def on_tap_callback
  @on_tap_callback
end

Instance Method Details

#cell_typeObject



13
14
15
# File 'lib/project/rows/button_row.rb', line 13

def cell_type
  ButtonCell
end

#listenObject



17
18
19
# File 'lib/project/rows/button_row.rb', line 17

def listen
  observe('FormCellWasTapped', 'tapped:')
end

#tapped(notification) ⇒ Object



21
22
23
24
25
26
27
# File 'lib/project/rows/button_row.rb', line 21

def tapped(notification)
  if notification.userInfo[:key] == key
    post('ButtonCallbackWillFire')

    on_tap_callback.call
  end
end

#update_cell(cell) ⇒ Object



29
30
31
# File 'lib/project/rows/button_row.rb', line 29

def update_cell(cell)
  super
end