Module: AppProfiler::Server
- Defined in:
- lib/app_profiler/server.rb
Constant Summary collapse
- HTTP_OK =
200
- HTTP_BAD_REQUEST =
400
- HTTP_NOT_FOUND =
404
- HTTP_NOT_ALLOWED =
405
- HTTP_CONFLICT =
409
- TRANSPORT_UNIX =
"unix"
- TRANSPORT_TCP =
"tcp"
- DEFAULTS =
{ enabled: false, transport: TRANSPORT_UNIX, cors: true, cors_host: "*", port: 0, duration: 30, }
Class Method Summary collapse
Class Method Details
.client ⇒ Object
387 388 389 390 391 |
# File 'lib/app_profiler/server.rb', line 387 def client return unless profile_server profile_server.client end |
.reset ⇒ Object
371 372 373 374 375 376 377 |
# File 'lib/app_profiler/server.rb', line 371 def reset self.profile_server = nil DEFAULTS.each do |config, value| class_variable_set(:"@@#{config}", value) # rubocop:disable Style/ClassVars end end |
.start(logger = Logger.new(IO::NULL)) ⇒ Object
379 380 381 382 383 384 385 |
# File 'lib/app_profiler/server.rb', line 379 def start(logger = Logger.new(IO::NULL)) return if profile_server self.profile_server = ProfileServer.new(AppProfiler::Server.transport, logger) profile_server.serve profile_server end |
.stop ⇒ Object
393 394 395 396 397 398 399 400 |
# File 'lib/app_profiler/server.rb', line 393 def stop return unless profile_server server = profile_server server.stop self.profile_server = nil server end |