Class: WorkflowTemplate::Action::Validated::Prepared
- Inherits:
-
Object
- Object
- WorkflowTemplate::Action::Validated::Prepared
- Extended by:
- Forwardable
- Includes:
- Abstract::Prepared
- Defined in:
- lib/workflow_template/action/validated.rb
Direct Known Subclasses
Constant Summary collapse
Instance Attribute Summary collapse
-
#unprepared ⇒ Object
readonly
Returns the value of attribute unprepared.
-
#validations ⇒ Object
readonly
Returns the value of attribute validations.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(unprepared, validations) ⇒ Prepared
constructor
A new instance of Prepared.
- #perform(state, receiver, &block) ⇒ Object
- #prepare(validations) ⇒ Object
Methods included from Abstract
Constructor Details
#initialize(unprepared, validations) ⇒ Prepared
Returns a new instance of Prepared.
57 58 59 60 61 |
# File 'lib/workflow_template/action/validated.rb', line 57 def initialize(unprepared, validations) @unprepared = unprepared @validations = validations freeze end |
Instance Attribute Details
#unprepared ⇒ Object (readonly)
Returns the value of attribute unprepared.
69 70 71 |
# File 'lib/workflow_template/action/validated.rb', line 69 def unprepared @unprepared end |
#validations ⇒ Object (readonly)
Returns the value of attribute validations.
69 70 71 |
# File 'lib/workflow_template/action/validated.rb', line 69 def validations @validations end |
Class Method Details
.instance(unprepared, validations) ⇒ Object
53 54 55 |
# File 'lib/workflow_template/action/validated.rb', line 53 def self.instance(unprepared, validations) new unprepared, validations.resolve_validations(unprepared.validates) end |
Instance Method Details
#perform(state, receiver, &block) ⇒ Object
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/workflow_template/action/validated.rb', line 71 def perform(state, receiver, &block) invoke_validated(state, receiver, &block) rescue *FATAL_SUBCLASSES raise rescue Fatal => e detailed = Fatal::Detailed.new(name, state., e.) raise detailed rescue ArgumentError => e invocation = method(:invoke_validated) raise Fatal::ArgumentError.new(name, e.) if Fatal::ArgumentError.depth(e, invocation) == 2 handle_standard_error(e, state) rescue StandardError => e handle_standard_error(e, state) end |
#prepare(validations) ⇒ Object
65 66 67 |
# File 'lib/workflow_template/action/validated.rb', line 65 def prepare(validations) self.class.instance(unprepared, validations) end |