Class: WorkflowTemplate::Action::Validated::Unprepared
- Inherits:
-
Object
- Object
- WorkflowTemplate::Action::Validated::Unprepared
- Includes:
- Abstract::Unprepared
- Defined in:
- lib/workflow_template/action/validated.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#defaults ⇒ Object
readonly
Returns the value of attribute defaults.
-
#state_transition_strategy ⇒ Object
readonly
Returns the value of attribute state_transition_strategy.
-
#validates ⇒ Object
readonly
Returns the value of attribute validates.
Attributes included from Abstract::Named
Class Method Summary collapse
Instance Method Summary collapse
- #describe ⇒ Object
-
#initialize(name, defaults: nil, validates: nil, state_transition_strategy: nil) ⇒ Unprepared
constructor
A new instance of Unprepared.
- #prepare(*args) ⇒ Object
Constructor Details
#initialize(name, defaults: nil, validates: nil, state_transition_strategy: nil) ⇒ Unprepared
Returns a new instance of Unprepared.
22 23 24 25 26 27 28 29 30 |
# File 'lib/workflow_template/action/validated.rb', line 22 def initialize(name, defaults: nil, validates: nil, state_transition_strategy: nil) @defaults = defaults.freeze @validates = self.class.normalize_validation_names(validates) unless state_transition_strategy.nil? @state_transition_strategy = State.normalize_transition_strategy(state_transition_strategy) end super(name) end |
Instance Attribute Details
#defaults ⇒ Object (readonly)
Returns the value of attribute defaults.
20 21 22 |
# File 'lib/workflow_template/action/validated.rb', line 20 def defaults @defaults end |
#state_transition_strategy ⇒ Object (readonly)
Returns the value of attribute state_transition_strategy.
20 21 22 |
# File 'lib/workflow_template/action/validated.rb', line 20 def state_transition_strategy @state_transition_strategy end |
#validates ⇒ Object (readonly)
Returns the value of attribute validates.
20 21 22 |
# File 'lib/workflow_template/action/validated.rb', line 20 def validates @validates end |
Class Method Details
.normalize_validation_names(option) ⇒ Object
13 14 15 16 17 18 |
# File 'lib/workflow_template/action/validated.rb', line 13 def self.normalize_validation_names(option) return if option.nil? return option.map(&:to_sym).freeze if option.is_a?(Array) option.to_sym.freeze end |
Instance Method Details
#describe ⇒ Object
36 37 38 |
# File 'lib/workflow_template/action/validated.rb', line 36 def describe Description::Validated.instance(self) end |
#prepare(*args) ⇒ Object
32 33 34 |
# File 'lib/workflow_template/action/validated.rb', line 32 def prepare(*args) raise NotImplementedError, "#{self.class.name}##{__method__} unimplemented" end |