method
add_introspection
ruby latest stable - Class:
XMLRPC::BasicServer
Method deprecated or moved
This method is deprecated or moved on the latest stable version. The last existing version (v2_2_9) is shown here.
add_introspection()public
Adds the introspection handlers “system.listMethods”, “system.methodSignature” and “system.methodHelp”, where only the first one works.
# File lib/xmlrpc/server.rb, line 236
def add_introspection
add_handler("system.listMethods",%(array), "List methods available on this XML-RPC server") do
methods = []
@handler.each do |name, obj|
if obj.kind_of? Proc
methods << name
else
obj.class.public_instance_methods(false).each do |meth|
methods << "#{name}#{meth}"
end
end
end
methods
end
add_handler("system.methodSignature", %(array string), "Returns method signature") do |meth|
sigs = []
@handler.each do |name, obj, sig|
if obj.kind_of? Proc and sig != nil and name == meth
if sig[0].kind_of? Array
# sig contains multiple signatures, e.g. [["array"], ["array", "string"]]
sig.each {|s| sigs << s}
else
# sig is a single signature, e.g. ["array"]
sigs << sig
end
end
end
sigs.uniq! || sigs # remove eventually duplicated signatures
end
add_handler("system.methodHelp", %(string string), "Returns help on using this method") do |meth|
help = nil
@handler.each do |name, obj, sig, hlp|
if obj.kind_of? Proc and name == meth
help = hlp
break
end
end
help || ""
end
self
end Related methods
- Instance methods
- add_handler
- add_introspection
- add_multicall
- get_default_handler
- get_service_hook
- process
- set_default_handler
- set_service_hook
- Class methods
- new
- Private methods
-
call_method -
check_arity -
dispatch -
handle -
multicall_fault