Class: PUNK::Action

Inherits:
Service show all
Defined in:
lib/punk/framework/action.rb

Instance Attribute Summary

Attributes included from Validatable

#errors

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Service

#result, run

Methods included from Loggable

#exception, #logger, #profile_debug, #profile_info, #profile_trace

Methods inherited from Runnable

args, #method_missing, #respond_to_missing?

Methods included from Validatable

#default_validation_helpers_options, #get_column_value, #valid?, #validate, #validates_not_empty

Methods included from Plugins::Validation::InstanceMethods

#validates_email, #validates_event, #validates_parse_id, #validates_phone, #validates_state, #validates_subdomain, #validates_url

Methods inherited from Settings

#method_missing, #respond_to_missing?

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class PUNK::Runnable

Class Method Details

.perform(**kwargs) ⇒ Object



5
6
7
8
# File 'lib/punk/framework/action.rb', line 5

def self.perform(**kwargs)
  action = profile_info("perform", kwargs) { run(**kwargs) }
  action.result
end

Instance Method Details

#present(view_class, **kwargs) ⇒ Object



14
15
16
17
# File 'lib/punk/framework/action.rb', line 14

def present(view_class, **kwargs)
  raise InternalServerError, "not a view: #{view_class}" unless view_class < View
  view_class.run(**kwargs)
end

#processObject

Raises:



10
11
12
# File 'lib/punk/framework/action.rb', line 10

def process
  raise NotImplemented, "action must provide process method"
end