Class: LcpRuby::Workflow::Approval::StepDefinition
- Inherits:
-
Object
- Object
- LcpRuby::Workflow::Approval::StepDefinition
- Defined in:
- lib/lcp_ruby/workflow/approval/step_definition.rb
Constant Summary collapse
- VALID_ASSIGNMENTS =
%w[all claim single].freeze
Instance Attribute Summary collapse
-
#approvers ⇒ Object
readonly
Returns the value of attribute approvers.
-
#assignment ⇒ Object
readonly
Returns the value of attribute assignment.
-
#condition ⇒ Object
readonly
Returns the value of attribute condition.
-
#fallback ⇒ Object
readonly
Returns the value of attribute fallback.
-
#label ⇒ Object
readonly
Returns the value of attribute label.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#required ⇒ Object
readonly
Returns the value of attribute required.
Class Method Summary collapse
Instance Method Summary collapse
- #conditional? ⇒ Boolean
-
#initialize(attrs = {}) ⇒ StepDefinition
constructor
A new instance of StepDefinition.
Constructor Details
#initialize(attrs = {}) ⇒ StepDefinition
Returns a new instance of StepDefinition.
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/lcp_ruby/workflow/approval/step_definition.rb', line 9 def initialize(attrs = {}) @name = attrs[:name].to_s @label = attrs[:label]&.to_s @approvers = attrs[:approvers] || {} @required = (attrs[:required] || 1).to_i @assignment = (attrs[:assignment] || "all").to_s @condition = attrs[:condition] @fallback = attrs[:fallback] validate! end |
Instance Attribute Details
#approvers ⇒ Object (readonly)
Returns the value of attribute approvers.
5 6 7 |
# File 'lib/lcp_ruby/workflow/approval/step_definition.rb', line 5 def approvers @approvers end |
#assignment ⇒ Object (readonly)
Returns the value of attribute assignment.
5 6 7 |
# File 'lib/lcp_ruby/workflow/approval/step_definition.rb', line 5 def assignment @assignment end |
#condition ⇒ Object (readonly)
Returns the value of attribute condition.
5 6 7 |
# File 'lib/lcp_ruby/workflow/approval/step_definition.rb', line 5 def condition @condition end |
#fallback ⇒ Object (readonly)
Returns the value of attribute fallback.
5 6 7 |
# File 'lib/lcp_ruby/workflow/approval/step_definition.rb', line 5 def fallback @fallback end |
#label ⇒ Object (readonly)
Returns the value of attribute label.
5 6 7 |
# File 'lib/lcp_ruby/workflow/approval/step_definition.rb', line 5 def label @label end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/lcp_ruby/workflow/approval/step_definition.rb', line 5 def name @name end |
#required ⇒ Object (readonly)
Returns the value of attribute required.
5 6 7 |
# File 'lib/lcp_ruby/workflow/approval/step_definition.rb', line 5 def required @required end |
Class Method Details
.from_hash(hash) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/lcp_ruby/workflow/approval/step_definition.rb', line 21 def self.from_hash(hash) hash = (hash || {}).transform_keys(&:to_s) new( name: hash["name"], label: hash["label"], approvers: hash["approvers"], required: hash["required"], assignment: hash["assignment"], condition: hash["condition"], fallback: hash["fallback"] ) end |
Instance Method Details
#conditional? ⇒ Boolean
34 35 36 |
# File 'lib/lcp_ruby/workflow/approval/step_definition.rb', line 34 def conditional? !@condition.nil? end |