Class: LcpRuby::Dsl::WorkflowBuilder::TransitionBlockContext
- Inherits:
-
Object
- Object
- LcpRuby::Dsl::WorkflowBuilder::TransitionBlockContext
- Defined in:
- lib/lcp_ruby/dsl/workflow_builder.rb
Instance Attribute Summary collapse
-
#events_to_fire ⇒ Object
readonly
Returns the value of attribute events_to_fire.
-
#fields_to_set ⇒ Object
readonly
Returns the value of attribute fields_to_set.
-
#guard_condition ⇒ Object
readonly
Returns the value of attribute guard_condition.
Instance Method Summary collapse
- #fire_events(*names) ⇒ Object
- #guard(condition) ⇒ Object
-
#initialize ⇒ TransitionBlockContext
constructor
A new instance of TransitionBlockContext.
- #set_fields(hash) ⇒ Object
Constructor Details
#initialize ⇒ TransitionBlockContext
Returns a new instance of TransitionBlockContext.
246 247 248 249 250 |
# File 'lib/lcp_ruby/dsl/workflow_builder.rb', line 246 def initialize @guard_condition = nil @fields_to_set = {} @events_to_fire = [] end |
Instance Attribute Details
#events_to_fire ⇒ Object (readonly)
Returns the value of attribute events_to_fire.
244 245 246 |
# File 'lib/lcp_ruby/dsl/workflow_builder.rb', line 244 def events_to_fire @events_to_fire end |
#fields_to_set ⇒ Object (readonly)
Returns the value of attribute fields_to_set.
244 245 246 |
# File 'lib/lcp_ruby/dsl/workflow_builder.rb', line 244 def fields_to_set @fields_to_set end |
#guard_condition ⇒ Object (readonly)
Returns the value of attribute guard_condition.
244 245 246 |
# File 'lib/lcp_ruby/dsl/workflow_builder.rb', line 244 def guard_condition @guard_condition end |
Instance Method Details
#fire_events(*names) ⇒ Object
260 261 262 |
# File 'lib/lcp_ruby/dsl/workflow_builder.rb', line 260 def fire_events(*names) @events_to_fire.concat(names.map(&:to_s)) end |
#guard(condition) ⇒ Object
252 253 254 |
# File 'lib/lcp_ruby/dsl/workflow_builder.rb', line 252 def guard(condition) @guard_condition = condition end |
#set_fields(hash) ⇒ Object
256 257 258 |
# File 'lib/lcp_ruby/dsl/workflow_builder.rb', line 256 def set_fields(hash) @fields_to_set = hash.transform_keys(&:to_s).transform_values { |v| normalize_set_field_value(v) } end |