Class: AppProfiler::Viewer::SpeedscopeRemoteViewer

Inherits:
BaseViewer
  • Object
show all
Defined in:
lib/app_profiler/viewer/speedscope_remote_viewer.rb,
lib/app_profiler/viewer/speedscope_remote_viewer/middleware.rb,
lib/app_profiler/viewer/speedscope_remote_viewer/base_middleware.rb

Defined Under Namespace

Classes: Middleware

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(profile) ⇒ SpeedscopeRemoteViewer

Returns a new instance of SpeedscopeRemoteViewer.



15
16
17
18
# File 'lib/app_profiler/viewer/speedscope_remote_viewer.rb', line 15

def initialize(profile)
  super()
  @profile = profile
end

Class Method Details

.view(profile, params = {}) ⇒ Object



10
11
12
# File 'lib/app_profiler/viewer/speedscope_remote_viewer.rb', line 10

def view(profile, params = {})
  new(profile).view(**params)
end

Instance Method Details

#view(response: nil, autoredirect: nil, async: false) ⇒ Object



20
21
22
23
24
25
26
27
28
29
# File 'lib/app_profiler/viewer/speedscope_remote_viewer.rb', line 20

def view(response: nil, autoredirect: nil, async: false)
  id = Middleware.id(@profile.file)

  if response && response[0].to_i < 500
    response[1]["Location"] = "/app_profiler/#{id}"
    response[0] = 303
  else
    AppProfiler.logger.info("[Profiler] Profile available at /app_profiler/#{id}\n")
  end
end