Class: AppProfiler::Viewer::SpeedscopeRemoteViewer::Middleware
- Inherits:
-
BaseMiddleware
- Object
- BaseMiddleware
- AppProfiler::Viewer::SpeedscopeRemoteViewer::Middleware
- Includes:
- Yarn::WithSpeedscope
- Defined in:
- lib/app_profiler/viewer/speedscope_remote_viewer/middleware.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ Middleware
constructor
A new instance of Middleware.
Methods included from Yarn::WithSpeedscope
Methods included from Yarn::Command
#setup_yarn, #valid_commands, #yarn, #yarn_setup, #yarn_setup=
Methods inherited from BaseMiddleware
Constructor Details
#initialize(app) ⇒ Middleware
Returns a new instance of Middleware.
12 13 14 15 16 17 |
# File 'lib/app_profiler/viewer/speedscope_remote_viewer/middleware.rb', line 12 def initialize(app) super @speedscope = Rack::File.new( File.join(AppProfiler.root, "node_modules/speedscope/dist/release"), ) end |
Instance Method Details
#call(env) ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/app_profiler/viewer/speedscope_remote_viewer/middleware.rb', line 19 def call(env) request = Rack::Request.new(env) return viewer(env, Regexp.last_match(1)) if request.path_info =~ %r(\A/app_profiler/speedscope/viewer/(.*)\z) return show(env, Regexp.last_match(1)) if request.path_info =~ %r(\A/app_profiler/speedscope/(.*)\z) super end |