Class: Corvette::Operation

Inherits:
Act
  • Object
show all
Extended by:
Forwardable
Includes:
Validation
Defined in:
lib/corvette/operation.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Act

#act_error, #act_name, #act_success, #initialize, #log_error, #logger, #process_callbacks, #process_params, #run

Methods included from Assertion

#assert

Constructor Details

This class inherits a constructor from Corvette::Act

Instance Attribute Details

#contractObject (readonly)

Returns the value of attribute contract.



17
18
19
# File 'lib/corvette/operation.rb', line 17

def contract
  @contract
end

Instance Method Details

#operation(model, params) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/corvette/operation.rb', line 19

def operation(model, params)
	operation_log(:start)
	process_params(params)
	operation_validate(model, params)
	yield
	act_success
	operation_log(:end)
rescue StandardError => exception
	log_error(exception, params)
	act_error(exception)
end