Module: Trailblazer::Activity::DSL::Linear::Helper::ClassMethods::Patch
- Defined in:
- lib/trailblazer/activity/dsl/linear/helper.rb
Class Method Summary collapse
Class Method Details
.call(activity, path, customization) ⇒ Object
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 |
# File 'lib/trailblazer/activity/dsl/linear/helper.rb', line 121 def call(activity, path, customization) task_id, *path = path patch = if task_id segment_activity = Introspect::Graph(activity).find(task_id).task patched_segment_activity = call(segment_activity, path, customization) # Replace the patched subprocess. -> { step Subprocess(patched_segment_activity), replace: task_id, id: task_id } else customization # apply the *actual* patch from the Subprocess() call. end patched_activity = Class.new(activity) patched_activity.class_exec(&patch) patched_activity end |
.customize(activity, options:) ⇒ Object
109 110 111 112 113 114 115 116 117 118 119 |
# File 'lib/trailblazer/activity/dsl/linear/helper.rb', line 109 def 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 |