Class: Trailblazer::Developer::Trace::Debugger::Node
- Inherits:
-
Struct
- Object
- Struct
- Trailblazer::Developer::Trace::Debugger::Node
- Defined in:
- lib/trailblazer/developer/trace/debugger.rb
Instance Attribute Summary collapse
-
#activity ⇒ Object
Returns the value of attribute activity.
-
#captured_input ⇒ Object
Returns the value of attribute captured_input.
-
#captured_node ⇒ Object
Returns the value of attribute captured_node.
-
#captured_output ⇒ Object
Returns the value of attribute captured_output.
-
#compile_id ⇒ Object
Returns the value of attribute compile_id.
-
#compile_path ⇒ Object
Returns the value of attribute compile_path.
-
#data ⇒ Object
Returns the value of attribute data.
-
#label ⇒ Object
Returns the value of attribute label.
-
#level ⇒ Object
Returns the value of attribute level.
-
#runtime_id ⇒ Object
Returns the value of attribute runtime_id.
-
#runtime_path ⇒ Object
Returns the value of attribute runtime_path.
-
#task ⇒ Object
Returns the value of attribute task.
Class Method Summary collapse
-
.build(tree, enumerable_tree, node_options: {}, normalizer: Debugger::Normalizer::PIPELINES.last, **options_for_nodes) ⇒ Object
we always key options for specific nodes by Stack::Captured::Input, so we don’t confuse activities if they were called multiple times.
- .build_for_stack(stack, **options_for_debugger_nodes) ⇒ Object
Instance Attribute Details
#activity ⇒ Object
Returns the value of attribute activity
5 6 7 |
# File 'lib/trailblazer/developer/trace/debugger.rb', line 5 def activity @activity end |
#captured_input ⇒ Object
Returns the value of attribute captured_input
5 6 7 |
# File 'lib/trailblazer/developer/trace/debugger.rb', line 5 def captured_input @captured_input end |
#captured_node ⇒ Object
Returns the value of attribute captured_node
5 6 7 |
# File 'lib/trailblazer/developer/trace/debugger.rb', line 5 def captured_node @captured_node end |
#captured_output ⇒ Object
Returns the value of attribute captured_output
5 6 7 |
# File 'lib/trailblazer/developer/trace/debugger.rb', line 5 def captured_output @captured_output end |
#compile_id ⇒ Object
Returns the value of attribute compile_id
5 6 7 |
# File 'lib/trailblazer/developer/trace/debugger.rb', line 5 def compile_id @compile_id end |
#compile_path ⇒ Object
Returns the value of attribute compile_path
5 6 7 |
# File 'lib/trailblazer/developer/trace/debugger.rb', line 5 def compile_path @compile_path end |
#data ⇒ Object
Returns the value of attribute data
5 6 7 |
# File 'lib/trailblazer/developer/trace/debugger.rb', line 5 def data @data end |
#label ⇒ Object
Returns the value of attribute label
5 6 7 |
# File 'lib/trailblazer/developer/trace/debugger.rb', line 5 def label @label end |
#level ⇒ Object
Returns the value of attribute level
5 6 7 |
# File 'lib/trailblazer/developer/trace/debugger.rb', line 5 def level @level end |
#runtime_id ⇒ Object
Returns the value of attribute runtime_id
5 6 7 |
# File 'lib/trailblazer/developer/trace/debugger.rb', line 5 def runtime_id @runtime_id end |
#runtime_path ⇒ Object
Returns the value of attribute runtime_path
5 6 7 |
# File 'lib/trailblazer/developer/trace/debugger.rb', line 5 def runtime_path @runtime_path end |
#task ⇒ Object
Returns the value of attribute task
5 6 7 |
# File 'lib/trailblazer/developer/trace/debugger.rb', line 5 def task @task end |
Class Method Details
.build(tree, enumerable_tree, node_options: {}, normalizer: Debugger::Normalizer::PIPELINES.last, **options_for_nodes) ⇒ Object
we always key options for specific nodes by Stack::Captured::Input, so we don’t confuse activities if they were called multiple times.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/trailblazer/developer/trace/debugger.rb', line 13 def self.build(tree, enumerable_tree, node_options: {}, normalizer: Debugger::Normalizer::PIPELINES.last, **) parent_map = Trace::Tree::ParentMap.build(tree).to_h # DISCUSS: can we use {enumerable_tree} for {ParentMap}? container_activity = enumerable_tree[0].captured_input.activity # TODO: any other way to grab the container_activity? Maybe via {activity.container_activity}? # TODO: cache activity graph top_activity = enumerable_tree[0].captured_input.task task_maps_per_activity = { container_activity => {top_activity => {id: nil}} # exposes {Introspect::TaskMap}-compatible interface. } # DISCUSS: this might change if we introduce a new Node type for Trace. debugger_nodes = enumerable_tree[0..-1].collect do |node| activity = node.captured_input.activity task = node.captured_input.task # it's possible to pass per-node options, like {label: "Yo!"} via {:node_options[<captured_input>]} = [node.captured_input] || {} task_map_for_activity = task_maps_per_activity[activity] || Activity::Introspect.TaskMap(activity) , _ = normalizer.( { captured_node: node, task: task, activity: activity, parent_map: parent_map, task_map_for_activity: task_map_for_activity, ** }, [] ) = .slice(*(.keys - [:parent_map, :task_map_for_activity])) # these attributes are not changing with the presentation Debugger::Node.new( captured_node: node, activity: activity, task: task, level: node.level, captured_input: node.captured_input, captured_output: node.captured_output, **, ).freeze end end |
.build_for_stack(stack, **options_for_debugger_nodes) ⇒ Object
66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/trailblazer/developer/trace/debugger.rb', line 66 def self.build_for_stack(stack, **) tree, processed = Trace.Tree(stack.to_a) enumerable_tree = Trace::Tree.Enumerable(tree) Debugger::Node.build( tree, enumerable_tree, **, ) end |