Class: SourceRoute::TpResult
- Inherits:
-
Object
- Object
- SourceRoute::TpResult
- Defined in:
- lib/source_route/tp_result.rb
Constant Summary collapse
- DEFAULT_ATTRS =
{ call: [:defined_class, :method_id], return: [:defined_class, :method_id, :return_value] }
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.
10 11 12 13 14 15 16 |
# File 'lib/source_route/tp_result.rb', line 10 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
24 25 26 27 28 29 30 |
# File 'lib/source_route/tp_result.rb', line 24 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
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/source_route/tp_result.rb', line 32 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 # 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
18 19 20 21 22 |
# File 'lib/source_route/tp_result.rb', line 18 def output_attributes(event) attrs = @output_config[:selected_attrs] || DEFAULT_ATTRS[event] attrs.push(:event) if @tp_events.size > 1 attrs end |