Method: ProMotion::MotionTable::SectionedTable#trigger_action

Defined in:
lib/ProMotion/screen_helpers/_tables/_sectioned_table.rb

#trigger_action(action, arguments) ⇒ Object



56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/ProMotion/screen_helpers/_tables/_sectioned_table.rb', line 56

def trigger_action(action, arguments)
  if self.respond_to?(action)
    expected_arguments = self.method(action).arity
    if expected_arguments == 0
      self.send(action)
    elsif expected_arguments == 1 || expected_arguments == -1
      self.send(action, arguments)
    else
      PM.logger.warn "#{action} expects #{expected_arguments} arguments. Maximum number of required arguments for an action is 1."
    end
  else
    PM.logger.info "Action not implemented: #{action.to_s}"
  end
end