Class: Sinatra::RPC::Handler::Introspection
- Inherits:
-
Object
- Object
- Sinatra::RPC::Handler::Introspection
- Defined in:
- lib/sinatra/rpc/handler/introspection.rb
Overview
The instrospection handler can be used to display metadata about the
RPC server. It adds the listMethods
, methodSignature
and methodHelp
RPC methods to
the system
namespace.
Instance Method Summary collapse
-
#initialize(app) ⇒ Introspection
constructor
The initializer requires a reference the current application.
-
#list_methods ⇒ Array
List the available methods.
-
#method_help(method_name) ⇒ String
Return a help for the given method.
-
#method_signature(method_name) ⇒ Array
Return the signature of the given method.
Constructor Details
#initialize(app) ⇒ Introspection
The initializer requires a reference the current application.
12 13 14 |
# File 'lib/sinatra/rpc/handler/introspection.rb', line 12 def initialize(app) @app = app end |
Instance Method Details
#list_methods ⇒ Array
List the available methods.
18 19 20 |
# File 'lib/sinatra/rpc/handler/introspection.rb', line 18 def list_methods index.keys.sort end |
#method_help(method_name) ⇒ String
Return a help for the given method.
32 33 34 |
# File 'lib/sinatra/rpc/handler/introspection.rb', line 32 def method_help(method_name) index[method_name][:help] end |
#method_signature(method_name) ⇒ Array
Return the signature of the given method.
25 26 27 |
# File 'lib/sinatra/rpc/handler/introspection.rb', line 25 def method_signature(method_name) index[method_name][:signature] end |