Documents diagnostics interface

Documents diagnostics interface

From 816b35975520bdfc388ebc488882dc0f3d9fa4a3 Mon Sep 17 00:00:00 2001
From: Ben Langfeld <blangfeld@powerhrg.com>
Date: Wed, 28 Nov 2018 10:50:57 -0200
Subject: [PATCH] Documents diagnostics interface


diff --git a/lib/message_bus/diagnostics.rb b/lib/message_bus/diagnostics.rb
index b6457a8..6ed87dc 100644
--- a/lib/message_bus/diagnostics.rb
+++ b/lib/message_bus/diagnostics.rb
@@ -1,5 +1,10 @@
+# MessageBus diagnostics are used for troubleshooting the bus and optimising its configuration
+# @see MessageBus::Rack::Diagnostics
 class MessageBus::Diagnostics
   class << self
+    # Enables diagnostics functionality
+    # @param [MessageBus::Instance] bus a specific instance of message_bus
+    # @return [void]
     def enable(bus = MessageBus)
       full_path = full_process_path
       start_time = Time.now.to_f
diff --git a/lib/message_bus/rack/diagnostics.rb b/lib/message_bus/rack/diagnostics.rb
index 809fdd9..9ffbcea 100644
--- a/lib/message_bus/rack/diagnostics.rb
+++ b/lib/message_bus/rack/diagnostics.rb
@@ -2,12 +2,19 @@
 
 module MessageBus::Rack; end
 
+# Accepts requests from clients interested in using diagnostics functionality
+# @see MessageBus::Diagnostics
 class MessageBus::Rack::Diagnostics
+  # @param [Proc] app the rack app
+  # @param [Hash] config
+  # @option config [MessageBus::Instance] :message_bus (`MessageBus`) a specific instance of message_bus
   def initialize(app, config = {})
     @app = app
     @bus = config[:message_bus] || MessageBus
   end
 
+  # Process an HTTP request from a subscriber client
+  # @param [Rack::Request::Env] env the request environment
   def call(env)
     return @app.call(env) unless env['PATH_INFO'].start_with? '/message-bus/_diagnostics'

GitHub