Class: AppProfiler::Viewer::FirefoxRemoteViewer

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

Defined Under Namespace

Classes: Middleware

Constant Summary collapse

NAME =
"firefox"

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseViewer

view

Constructor Details

#initialize(profile) ⇒ FirefoxRemoteViewer

Returns a new instance of FirefoxRemoteViewer.



16
17
18
19
# File 'lib/app_profiler/viewer/firefox_remote_viewer.rb', line 16

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

Class Method Details

.remote?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/app_profiler/viewer/firefox_remote_viewer.rb', line 11

def remote?
  true
end

Instance Method Details

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



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

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/#{NAME}/viewer/#{id}"
    response[0] = 303
  else
    AppProfiler.logger.info("[Profiler] Profile available at /app_profiler/#{id}\n")
  end
end