Class: SourceRoute::Wrapper
- Inherits:
-
Object
- Object
- SourceRoute::Wrapper
- Includes:
- Singleton
- Defined in:
- lib/source_route/wrapper.rb
Defined Under Namespace
Classes: Condition
Constant Summary collapse
- TRACE_POINT_METHODS =
[:defined_class, :method_id, :path, :lineno]
Instance Attribute Summary collapse
-
#condition ⇒ Object
Returns the value of attribute condition.
-
#tp ⇒ Object
Returns the value of attribute tp.
-
#tp_attrs_results ⇒ Object
Returns the value of attribute tp_attrs_results.
Instance Method Summary collapse
-
#initialize ⇒ Wrapper
constructor
A new instance of Wrapper.
- #reset ⇒ Object
- #trace ⇒ Object
Constructor Details
#initialize ⇒ Wrapper
Returns a new instance of Wrapper.
35 36 37 |
# File 'lib/source_route/wrapper.rb', line 35 def initialize reset end |
Instance Attribute Details
#condition ⇒ Object
Returns the value of attribute condition.
8 9 10 |
# File 'lib/source_route/wrapper.rb', line 8 def condition @condition end |
#tp ⇒ Object
Returns the value of attribute tp.
8 9 10 |
# File 'lib/source_route/wrapper.rb', line 8 def tp @tp end |
#tp_attrs_results ⇒ Object
Returns the value of attribute tp_attrs_results.
8 9 10 |
# File 'lib/source_route/wrapper.rb', line 8 def tp_attrs_results @tp_attrs_results end |
Instance Method Details
#reset ⇒ Object
39 40 41 42 43 44 45 |
# File 'lib/source_route/wrapper.rb', line 39 def reset @tp.disable if @tp @condition = Condition.new([:call], {}, {}, TpResult::Config.new('silence', [], false, false)) @tp_attrs_results = [] self end |
#trace ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/source_route/wrapper.rb', line 47 def trace # dont wanna init it in tp block, cause tp block could run thousands of times in one cycle trace tp_result = TpResult.new(self) tp_filter = TpFilter.new(condition) track = TracePoint.new *condition.events do |tp| next if tp_filter.block_it?(tp) unless condition.result_config.format.is_a? Proc ret_data = tp_result.build(tp) tp_attrs_results.push(ret_data) end tp_result.output(tp) end track.enable self.tp = track track end |