Class: Igniter::Extensions::Contracts::Creator::WorkflowStep
- Inherits:
-
Object
- Object
- Igniter::Extensions::Contracts::Creator::WorkflowStep
- Defined in:
- lib/igniter/extensions/contracts/creator/workflow_step.rb
Constant Summary collapse
- VALID_STATUSES =
%i[complete ready needs_attention pending].freeze
Instance Attribute Summary collapse
-
#hints ⇒ Object
readonly
Returns the value of attribute hints.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#summary ⇒ Object
readonly
Returns the value of attribute summary.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Instance Method Summary collapse
- #actionable? ⇒ Boolean
- #complete? ⇒ Boolean
-
#initialize(key:, status:, title:, summary:, hints: []) ⇒ WorkflowStep
constructor
A new instance of WorkflowStep.
- #to_h ⇒ Object
Constructor Details
#initialize(key:, status:, title:, summary:, hints: []) ⇒ WorkflowStep
Returns a new instance of WorkflowStep.
12 13 14 15 16 17 18 19 |
# File 'lib/igniter/extensions/contracts/creator/workflow_step.rb', line 12 def initialize(key:, status:, title:, summary:, hints: []) @key = key.to_sym @status = normalize_status(status) @title = title @summary = summary @hints = Array(hints).map(&:to_s).uniq.freeze freeze end |
Instance Attribute Details
#hints ⇒ Object (readonly)
Returns the value of attribute hints.
10 11 12 |
# File 'lib/igniter/extensions/contracts/creator/workflow_step.rb', line 10 def hints @hints end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
10 11 12 |
# File 'lib/igniter/extensions/contracts/creator/workflow_step.rb', line 10 def key @key end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
10 11 12 |
# File 'lib/igniter/extensions/contracts/creator/workflow_step.rb', line 10 def status @status end |
#summary ⇒ Object (readonly)
Returns the value of attribute summary.
10 11 12 |
# File 'lib/igniter/extensions/contracts/creator/workflow_step.rb', line 10 def summary @summary end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
10 11 12 |
# File 'lib/igniter/extensions/contracts/creator/workflow_step.rb', line 10 def title @title end |
Instance Method Details
#actionable? ⇒ Boolean
25 26 27 |
# File 'lib/igniter/extensions/contracts/creator/workflow_step.rb', line 25 def actionable? %i[ready needs_attention].include?(status) end |
#complete? ⇒ Boolean
21 22 23 |
# File 'lib/igniter/extensions/contracts/creator/workflow_step.rb', line 21 def complete? status == :complete end |
#to_h ⇒ Object
29 30 31 32 33 34 35 36 37 |
# File 'lib/igniter/extensions/contracts/creator/workflow_step.rb', line 29 def to_h { key: key, status: status, title: title, summary: summary, hints: hints } end |