Class: LcpRuby::Dsl::WorkflowBuilder::StepBlockContext

Inherits:
Object
  • Object
show all
Defined in:
lib/lcp_ruby/dsl/workflow_builder.rb

Instance Method Summary collapse

Constructor Details

#initialize(name, label) ⇒ StepBlockContext

Returns a new instance of StepBlockContext.



201
202
203
204
205
206
207
208
209
# File 'lib/lcp_ruby/dsl/workflow_builder.rb', line 201

def initialize(name, label)
  @name = name.to_s
  @label = label
  @approvers_value = nil
  @required_value = nil
  @assignment_value = nil
  @condition_value = nil
  @fallback_value = nil
end

Instance Method Details

#approvers(hash) ⇒ Object



211
212
213
# File 'lib/lcp_ruby/dsl/workflow_builder.rb', line 211

def approvers(hash)
  @approvers_value = hash.transform_keys(&:to_s)
end

#assignment(value) ⇒ Object



219
220
221
# File 'lib/lcp_ruby/dsl/workflow_builder.rb', line 219

def assignment(value)
  @assignment_value = value.to_s
end

#condition(cond) ⇒ Object



223
224
225
# File 'lib/lcp_ruby/dsl/workflow_builder.rb', line 223

def condition(cond)
  @condition_value = cond.is_a?(Hash) ? HashUtils.stringify_deep(cond) : cond
end

#fallback(hash) ⇒ Object



227
228
229
# File 'lib/lcp_ruby/dsl/workflow_builder.rb', line 227

def fallback(hash)
  @fallback_value = hash.transform_keys(&:to_s)
end

#required(value) ⇒ Object



215
216
217
# File 'lib/lcp_ruby/dsl/workflow_builder.rb', line 215

def required(value)
  @required_value = value
end

#to_hashObject



231
232
233
234
235
236
237
238
239
240
# File 'lib/lcp_ruby/dsl/workflow_builder.rb', line 231

def to_hash
  hash = { "name" => @name }
  hash["label"] = @label.to_s if @label
  hash["approvers"] = @approvers_value if @approvers_value
  hash["required"] = @required_value if @required_value
  hash["assignment"] = @assignment_value if @assignment_value
  hash["condition"] = @condition_value if @condition_value
  hash["fallback"] = @fallback_value if @fallback_value
  hash
end