Class: Plutonium::Wizard::Step
- Inherits:
-
Object
- Object
- Plutonium::Wizard::Step
- 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
Instance Attribute Summary collapse
-
#condition ⇒ Object
readonly
Returns the value of attribute condition.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#fields ⇒ Object
readonly
Returns the value of attribute fields.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#label ⇒ Object
readonly
Returns the value of attribute label.
-
#on_rollback ⇒ Object
readonly
Returns the value of attribute on_rollback.
-
#on_submit ⇒ Object
readonly
Returns the value of attribute on_submit.
-
#using_spec ⇒ Object
readonly
Returns the value of attribute using_spec.
Instance Method Summary collapse
-
#attribute_options ⇒ Object
The per-attribute options (=> {default:, ...}) contributed to the typed
datasnapshot, so e.g. -
#attribute_schema ⇒ Object
The effective attribute schema (=> type) contributed to the union
dataschema — ausing:import composed with inlineattributedeclarations (inline wins on conflict, §2.4). -
#form_layout ⇒ Object
The step's form sections (§7.1): inline
form_layoutwins, else the layout inherited from ausing:source (filtered to imported fields), else nil. -
#imported_form_validators ⇒ Object
Form-metadata validators contributed by a
using:import ([args, options] pairs), replayed onto the typed data class alongside inlinevalidationsso imported fields surface required/length/etc. -
#imported_validate_fn ⇒ Object
The imported validation runner (=> [messages] over a data slice), or nil when there's no
using:import orvalidate: false. -
#initialize(key:, fields:, label: nil, description: nil, condition: nil, on_submit: nil, on_rollback: nil, using_spec: nil) ⇒ Step
constructor
A new instance of Step.
-
#inputs ⇒ Object
The effective input config (=> {options:, block:}) — imported inputs composed with inline
input/fielddeclarations (inline wins). - #review? ⇒ Boolean
-
#structured_inputs ⇒ Object
The structured inputs declared in this step (=> {options:, block:}).
-
#validations ⇒ Object
Inline
validatesdeclarations recorded for this step (raw [args, options]).
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
#condition ⇒ Object (readonly)
Returns the value of attribute condition.
9 10 11 |
# File 'lib/plutonium/wizard/step.rb', line 9 def condition @condition end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
9 10 11 |
# File 'lib/plutonium/wizard/step.rb', line 9 def description @description end |
#fields ⇒ Object (readonly)
Returns the value of attribute fields.
9 10 11 |
# File 'lib/plutonium/wizard/step.rb', line 9 def fields @fields end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
9 10 11 |
# File 'lib/plutonium/wizard/step.rb', line 9 def key @key end |
#label ⇒ Object (readonly)
Returns the value of attribute label.
9 10 11 |
# File 'lib/plutonium/wizard/step.rb', line 9 def label @label end |
#on_rollback ⇒ Object (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_submit ⇒ Object (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_spec ⇒ Object (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_options ⇒ Object
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 = fields. |
#attribute_schema ⇒ Object
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_layout ⇒ Object
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_validators ⇒ Object
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_fn ⇒ Object
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 |
#inputs ⇒ Object
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
24 |
# File 'lib/plutonium/wizard/step.rb', line 24 def review? = false |
#structured_inputs ⇒ Object
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 |
#validations ⇒ Object
Inline validates declarations recorded for this step (raw [args, options]).
45 |
# File 'lib/plutonium/wizard/step.rb', line 45 def validations = fields.validations |