Class: SourceRoute::TpResult
- Inherits:
-
Object
- Object
- SourceRoute::TpResult
- Defined in:
- lib/source_route/tp_result.rb
Defined Under Namespace
Classes: Config
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, :return_value], 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.
25 26 27 28 29 30 31 |
# File 'lib/source_route/tp_result.rb', line 25 def initialize(wrapper) @wrapper = wrapper @config = @wrapper.condition.result_config @tp_events = @wrapper.condition.events end |
Instance Method Details
#build(trace_point_instance) ⇒ Object
39 40 41 42 43 44 45 |
# File 'lib/source_route/tp_result.rb', line 39 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
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/source_route/tp_result.rb', line 47 def output(tp_ins) format = @config.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 :stack_overflow console_stack_overflow 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
33 34 35 36 37 |
# File 'lib/source_route/tp_result.rb', line 33 def output_attributes(event) attrs = DEFAULT_ATTRS[event] + Array(@config.show_additional_attrs) attrs.push(:event) if @tp_events.size > 1 attrs.uniq end |