Class: ScoutApm::LayerConverters::FindLayerByType
- Inherits:
-
Object
- Object
- ScoutApm::LayerConverters::FindLayerByType
- Defined in:
- lib/scout_apm/layer_converters/find_layer_by_type.rb
Instance Method Summary collapse
- #call(layer_types) ⇒ Object
- #controller ⇒ Object
-
#initialize(request) ⇒ FindLayerByType
constructor
A new instance of FindLayerByType.
- #job ⇒ Object
- #queue ⇒ Object
- #scope ⇒ Object
Constructor Details
#initialize(request) ⇒ FindLayerByType
Returns a new instance of FindLayerByType.
11 12 13 |
# File 'lib/scout_apm/layer_converters/find_layer_by_type.rb', line 11 def initialize(request) @request = request end |
Instance Method Details
#call(layer_types) ⇒ Object
31 32 33 34 35 |
# File 'lib/scout_apm/layer_converters/find_layer_by_type.rb', line 31 def call(layer_types) walker = DepthFirstWalker.new(@request.root_layer) walker.on {|l| return l if layer_types.include?(l.type) } walker.walk end |
#controller ⇒ Object
19 20 21 |
# File 'lib/scout_apm/layer_converters/find_layer_by_type.rb', line 19 def controller @controller ||= call(["Controller"]) end |
#job ⇒ Object
23 24 25 |
# File 'lib/scout_apm/layer_converters/find_layer_by_type.rb', line 23 def job @job ||= call(["Job"]) end |
#queue ⇒ Object
27 28 29 |
# File 'lib/scout_apm/layer_converters/find_layer_by_type.rb', line 27 def queue @queue ||= call(["Queue"]) end |
#scope ⇒ Object
15 16 17 |
# File 'lib/scout_apm/layer_converters/find_layer_by_type.rb', line 15 def scope @scope ||= call(["Controller", "Job"]) end |