Class: Plutonium::Wizard::Step

Inherits:
Object
  • Object
show all
Defined in:
lib/plutonium/wizard/step.rb

Overview

Metadata for one wizard step: its key, label, branching condition, captured field surface, per-step hooks, and the using: import marker (resolved in Task 3). A value object — holds no runtime state.

Direct Known Subclasses

ReviewStep

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key:, fields:, label: nil, description: nil, condition: nil, on_submit: nil, on_rollback: nil, using_spec: nil) ⇒ Step

Returns a new instance of Step.



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/plutonium/wizard/step.rb', line 12

def initialize(key:, fields:, label: nil, description: nil, condition: nil,
  on_submit: nil, on_rollback: nil, using_spec: nil)
  @key = key
  @label = label || key.to_s.humanize
  @description = description
  @condition = condition
  @fields = fields
  @on_submit = on_submit
  @on_rollback = on_rollback
  @using_spec = using_spec
end

Instance Attribute Details

#conditionObject (readonly)

Returns the value of attribute condition.



9
10
11
# File 'lib/plutonium/wizard/step.rb', line 9

def condition
  @condition
end

#descriptionObject (readonly)

Returns the value of attribute description.



9
10
11
# File 'lib/plutonium/wizard/step.rb', line 9

def description
  @description
end

#fieldsObject (readonly)

Returns the value of attribute fields.



9
10
11
# File 'lib/plutonium/wizard/step.rb', line 9

def fields
  @fields
end

#keyObject (readonly)

Returns the value of attribute key.



9
10
11
# File 'lib/plutonium/wizard/step.rb', line 9

def key
  @key
end

#labelObject (readonly)

Returns the value of attribute label.



9
10
11
# File 'lib/plutonium/wizard/step.rb', line 9

def label
  @label
end

#on_rollbackObject (readonly)

Returns the value of attribute on_rollback.



9
10
11
# File 'lib/plutonium/wizard/step.rb', line 9

def on_rollback
  @on_rollback
end

#on_submitObject (readonly)

Returns the value of attribute on_submit.



9
10
11
# File 'lib/plutonium/wizard/step.rb', line 9

def on_submit
  @on_submit
end

#using_specObject (readonly)

Returns the value of attribute using_spec.



9
10
11
# File 'lib/plutonium/wizard/step.rb', line 9

def using_spec
  @using_spec
end

Instance Method Details

#attribute_optionsObject

The per-attribute options (=> {default:, ...}) contributed to the typed data snapshot, so e.g. default: applies (§2.6).



38
# File 'lib/plutonium/wizard/step.rb', line 38

def attribute_options = fields.attribute_options

#attribute_schemaObject

The effective attribute schema (=> type) contributed to the union data schema — a using: import composed with inline attribute declarations (inline wins on conflict, §2.4).



34
# File 'lib/plutonium/wizard/step.rb', line 34

def attribute_schema = fields.attribute_schema

#form_layoutObject

The step's form sections (§7.1): inline form_layout wins, else the layout inherited from a using: source (filtered to imported fields), else nil. Resolved lazily so a using: import is only loaded when actually needed.



29
# File 'lib/plutonium/wizard/step.rb', line 29

def form_layout = fields.form_layout_sections

#imported_form_validatorsObject

Form-metadata validators contributed by a using: import ([args, options] pairs), replayed onto the typed data class alongside inline validations so imported fields surface required/length/etc. — without feeding the runner (which validates imports through the transient model).



51
# File 'lib/plutonium/wizard/step.rb', line 51

def imported_form_validators = fields.imported_form_validators

#imported_validate_fnObject

The imported validation runner (=> [messages] over a data slice), or nil when there's no using: import or validate: false.



55
# File 'lib/plutonium/wizard/step.rb', line 55

def imported_validate_fn = fields.imported_validate_fn

#inputsObject

The effective input config (=> {options:, block:}) — imported inputs composed with inline input/field declarations (inline wins).



42
# File 'lib/plutonium/wizard/step.rb', line 42

def inputs = fields.inputs

#review?Boolean

Returns:

  • (Boolean)


24
# File 'lib/plutonium/wizard/step.rb', line 24

def review? = false

#structured_inputsObject

The structured inputs declared in this step (=> {options:, block:}).



58
# File 'lib/plutonium/wizard/step.rb', line 58

def structured_inputs = fields.defined_structured_inputs

#validationsObject

Inline validates declarations recorded for this step (raw [args, options]).



45
# File 'lib/plutonium/wizard/step.rb', line 45

def validations = fields.validations