Module: Trailblazer::Activity::DSL::Linear::Patch
- Defined in:
- lib/trailblazer/activity/dsl/linear/feature/patch.rb
Defined Under Namespace
Modules: DSL
Class Method Summary collapse
- .call(activity, path, customization, patched_activity: Class.new(activity)) ⇒ Object
-
.customize(activity, options:) ⇒ Object
Currently, this is called from the Subprocess() helper.
Class Method Details
.call(activity, path, customization, patched_activity: Class.new(activity)) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/trailblazer/activity/dsl/linear/feature/patch.rb', line 18 def self.call(activity, path, customization, patched_activity: Class.new(activity)) task_id, *path = path patch = if task_id segment_activity = Introspect.Nodes(activity, id: task_id).task patched_segment_activity = call(segment_activity, path, customization) # Replace the patched subprocess. -> { step Subprocess(patched_segment_activity), inherit: true, replace: task_id, id: task_id } else customization # apply the *actual* patch from the Subprocess() call. end patched_activity.class_exec(&patch) patched_activity end |
.customize(activity, options:) ⇒ Object
Currently, this is called from the Subprocess() helper.
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/trailblazer/activity/dsl/linear/feature/patch.rb', line 6 def self.customize(activity, options:) = .is_a?(Proc) ? {[] => } : # hash-wrapping with empty path, for patching given activity itself .each do |path, patch| activity = call(activity, path, patch) # TODO: test if multiple patches works! end activity end |