Module: Trailblazer::Developer::Render::TaskWrap
- Defined in:
- lib/trailblazer/developer/render/task_wrap.rb
Class Method Summary collapse
- .render_for(activity, node) ⇒ Object
- .render_input(row, level) ⇒ Object
- .render_pipeline(pipeline, level) ⇒ Object
- .render_task_wrap_step(row, level) ⇒ Object
- .task_wrap_for_activity(activity) ⇒ Object
Class Method Details
.render_for(activity, node) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/trailblazer/developer/render/task_wrap.rb', line 6 def self.render_for(activity, node) task_wrap = task_wrap_for_activity(activity) # TODO: MERGE WITH BELOW task = node.task step_wrap = task_wrap[task] # the taskWrap for the actual step, e.g. {input,call_task,output}. level = 2 nodes = render_pipeline(step_wrap, level) nodes = [[0, activity], [1, node.id], *nodes] Hirb::Console.format_output(nodes, class: :tree, type: :directory, multi_line_nodes: true) end |
.render_input(row, level) ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/trailblazer/developer/render/task_wrap.rb', line 48 def self.render_input(row, level) variable_mapping = Activity::DSL::Linear::VariableMapping input_pipe = row[1].instance_variable_get(:@pipe) # this is again a {TaskWrap::Pipeline}. filters = input_pipe.to_a.collect do |id, filter| id, class_name, info = if filter.is_a?(variable_mapping::AddVariables) || filter.is_a?(variable_mapping::SetVariable) # TODO: grab user_filter here if needed for understanding # _info = filter.instance_variable_get(:@user_filter).inspect # we could even grab the source code for callables here! _info = "" [id, filter.class.to_s.match(/VariableMapping::.+/), _info] else # generic VariableMapping::DSL step such as {VariableMapping.scope} _name = filter.inspect.match(/VariableMapping\.\w+/) [id.to_s, _name, ""] end text = "#{id.ljust(45, ".")} #{info.ljust(45, ".")} #{class_name}" [level+1, text] end # pp filters render_task_wrap_step(row, level) + filters # render_task_wrap_step(row, level) end |
.render_pipeline(pipeline, level) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/trailblazer/developer/render/task_wrap.rb', line 24 def self.render_pipeline(pipeline, level) renderers = Hash.new(method(:render_task_wrap_step)) renderers.merge!( Trailblazer::Activity::DSL::Linear::VariableMapping::Pipe::Input => method(:render_input), Trailblazer::Activity::DSL::Linear::VariableMapping::Pipe::Output => method(:render_input), ) # TODO: use collect nodes=[] pipeline.to_a.collect do |row| renderer = renderers[row[1].class] nodes = nodes + renderer.(row, level) # call the rendering component. end nodes end |
.render_task_wrap_step(row, level) ⇒ Object
42 43 44 45 46 |
# File 'lib/trailblazer/developer/render/task_wrap.rb', line 42 def self.render_task_wrap_step(row, level) text = row.id.to_s.ljust(33, ".") + row[1].class.to_s [[level, text]] end |
.task_wrap_for_activity(activity) ⇒ Object
20 21 22 |
# File 'lib/trailblazer/developer/render/task_wrap.rb', line 20 def self.task_wrap_for_activity(activity, **) activity.to_h[:config][:wrap_static] end |