Class: SourceRoute::TraceChain
- Extended by:
- Forwardable
- Includes:
- Enumerable
- Defined in:
- lib/source_route/trace_chain.rb
Overview
delegate to Array
Instance Attribute Summary collapse
-
#chain ⇒ Object
readonly
Returns the value of attribute chain.
Instance Method Summary collapse
- #call_chain ⇒ Object
- #import_return_value_to_call_chain ⇒ Object
-
#initialize ⇒ TraceChain
constructor
A new instance of TraceChain.
-
#parent_length_list ⇒ Object
seems not used in html template now 2015.9.17.
- #return_chain ⇒ Object
- #treeize_call_chain ⇒ Object
Constructor Details
#initialize ⇒ TraceChain
Returns a new instance of TraceChain.
11 12 13 |
# File 'lib/source_route/trace_chain.rb', line 11 def initialize @chain = [] end |
Instance Attribute Details
#chain ⇒ Object (readonly)
Returns the value of attribute chain.
4 5 6 |
# File 'lib/source_route/trace_chain.rb', line 4 def chain @chain end |
Instance Method Details
#call_chain ⇒ Object
15 16 17 |
# File 'lib/source_route/trace_chain.rb', line 15 def call_chain select(&:call_event?) end |
#import_return_value_to_call_chain ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'lib/source_route/trace_chain.rb', line 23 def import_return_value_to_call_chain call_chain.each do |ctp| matched_return_tp = return_chain.reject(&:matched?).detect {|rtp| rtp == ctp} unless matched_return_tp.nil? matched_return_tp.return_tp_assign_call_tp(ctp) end end end |
#parent_length_list ⇒ Object
seems not used in html template now 2015.9.17
55 56 57 |
# File 'lib/source_route/trace_chain.rb', line 55 def parent_length_list call_chain.map { |tp| tp.parent_length }.uniq.sort end |
#return_chain ⇒ Object
19 20 21 |
# File 'lib/source_route/trace_chain.rb', line 19 def return_chain select(&:return_event?) end |
#treeize_call_chain ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/source_route/trace_chain.rb', line 32 def treeize_call_chain init_order_id_and_parent_ids call_chain.each do |tpr| # find the return trace point for the call trace point return_tpr = return_chain.reject(&:locate_opposite?).find { |rtpr| rtpr == tpr } # so trace points between the call trace point and its return trace point # are all children of it unless return_tpr.nil? return_tpr.found_opposite start_index, end_index = tpr.order_id, return_tpr.order_id unless end_index == start_index + 1 values_at(start_index+1 ... end_index).select(&:call_event?).each do |ct| ct.parent_ids.push start_index tpr.direct_child_order_ids.push ct.order_id end end end end cal_parent_length end |