Class: WorkflowTemplate::Action::Validated::Unprepared

Inherits:
Object
  • Object
show all
Includes:
Abstract::Unprepared
Defined in:
lib/workflow_template/action/validated.rb

Direct Known Subclasses

Simple::Unprepared, Wrapper::Unprepared

Instance Attribute Summary collapse

Attributes included from Abstract::Named

#name

Class Method Summary collapse

Instance Method Summary collapse

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

#defaultsObject (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_strategyObject (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

#validatesObject (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

#describeObject



36
37
38
# File 'lib/workflow_template/action/validated.rb', line 36

def describe
  Description::Validated.instance(self)
end

#prepare(*args) ⇒ Object

Raises:

  • (NotImplementedError)


32
33
34
# File 'lib/workflow_template/action/validated.rb', line 32

def prepare(*args)
  raise NotImplementedError, "#{self.class.name}##{__method__} unimplemented"
end