Class: ScoutApm::LayerConverterBase

Inherits:
Object
  • Object
show all
Defined in:
lib/scout_apm/layer_converter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(request) ⇒ LayerConverterBase

Returns a new instance of LayerConverterBase.



7
8
9
10
11
# File 'lib/scout_apm/layer_converter.rb', line 7

def initialize(request)
  @request = request
  @root_layer = request.root_layer
  @walker = LayerDepthFirstWalker.new(root_layer)
end

Instance Attribute Details

#requestObject (readonly)

Returns the value of attribute request.



4
5
6
# File 'lib/scout_apm/layer_converter.rb', line 4

def request
  @request
end

#root_layerObject (readonly)

Returns the value of attribute root_layer.



5
6
7
# File 'lib/scout_apm/layer_converter.rb', line 5

def root_layer
  @root_layer
end

#walkerObject (readonly)

Returns the value of attribute walker.



3
4
5
# File 'lib/scout_apm/layer_converter.rb', line 3

def walker
  @walker
end

Instance Method Details

#scope_layerObject

Scope is determined by the first Controller we hit. Most of the time there will only be 1 anyway. But if you have a controller that calls another controller method, we may pick that up:

def update
  show
  render :update
end


20
21
22
23
24
25
26
# File 'lib/scout_apm/layer_converter.rb', line 20

def scope_layer
  @scope_layer ||= walker.walk do |layer|
    if layer.type == "Controller"
      break layer
    end
  end
end