Class: SourceRoute::TpResult
- Inherits:
-
Object
- Object
- SourceRoute::TpResult
- Defined in:
- lib/source_route/tp_result.rb
Constant Summary collapse
- DEFAULT_ATTRS =
see event description in TracePoint API Doc
{ call: [:defined_class, :method_id], return: [:defined_class, :method_id, :return_value], c_call: [:defined_class, :method_id], line: [:path, :lineno], # following are not tested yet class: [:defined_class], end: [:defined_class], c_return: [:defined_class, :method_id, :return_value], raise: [:raised_exception], b_call: [:binding, :defined_class, :method_id], b_return: [:binding, :defined_class, :method_id], thread_begin: [:defined_class, :method_id], thread_end: [:defined_class, :method_id] }
Instance Method Summary collapse
- #build(trace_point_instance) ⇒ Object
-
#initialize(wrapper) ⇒ TpResult
constructor
A new instance of TpResult.
- #output(tp_ins) ⇒ Object
- #output_attributes(event) ⇒ Object
Constructor Details
#initialize(wrapper) ⇒ TpResult
Returns a new instance of TpResult.
22 23 24 25 26 27 28 |
# File 'lib/source_route/tp_result.rb', line 22 def initialize(wrapper) @wrapper = wrapper @output_config = @wrapper.conditions.result_config @tp_events = @wrapper.conditions.events end |
Instance Method Details
#build(trace_point_instance) ⇒ Object
36 37 38 39 40 41 42 |
# File 'lib/source_route/tp_result.rb', line 36 def build(trace_point_instance) @tp = trace_point_instance collect_tp_data collect_local_var_data collect_instance_var_data @collect_data end |
#output(tp_ins) ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/source_route/tp_result.rb', line 44 def output(tp_ins) format = @output_config[:output_format] format = format.to_sym if format.respond_to? :to_sym case format when :none # do nothing when :console # need @collect_data console_put when :html # I cant solve the problem: to generate html at the end, # I have to know when the application is end when :test, :silence # do nothing at now when Proc format.call(tp_ins) else klass = "SourceRoute::Formats::#{format.to_s.capitalize}" ::SourceRoute.const_get(klass).render(self, tp_ins) end end |
#output_attributes(event) ⇒ Object
30 31 32 33 34 |
# File 'lib/source_route/tp_result.rb', line 30 def output_attributes(event) attrs = @output_config[:selected_attrs] || DEFAULT_ATTRS[event] attrs.push(:event) if @tp_events.size > 1 attrs end |