Ruby 1.9.2 リファレンスマニュアル > ライブラリ一覧 > xmlrpc/clientライブラリ > XMLRPC::Client::Proxyクラス

class XMLRPC::Client::Proxy

クラスの継承リスト: XMLRPC::Client::Proxy < XMLRPC::Client < Object < Kernel < BasicObject

Abstract

Class XMLRPC::Client::Proxy makes XML-RPC calls look nicer!

You can call any method onto objects of that class - the object handles method_missing and will forward the method call to a XML-RPC server. Don't use this class directly, but use instead method [[unknown:XMLRPC::Client#proxy]] or XMLRPC::Client#proxy2.

Every method call is forwarded to the XML-RPC server defined in XMLRPC::Client::Proxy.new.

Note: Inherited methods from class Object cannot be used as XML-RPC names, because they get around method_missing.

require "xmlrpc/client"

server = XMLRPC::Client.new("www.ruby-lang.org", "/RPC2", 80)

michael  = server.proxy("michael")
michael2 = server.proxy("michael", 4)

# both calls should return the same value '9'.
p michael.add(4,5)
p michael2.add(5)

特異メソッド

new(server, prefix, args=[], meth=:call, delim=".")

Creates an object which provides method_missing.

server must be of type XMLRPC::Client, which is the XML-RPC server to be used for a XML-RPC call. prefix and delim will be prepended to the methodname called onto this object.

Parameter meth is the method (call, call2, call_async, call2_async) to use for a RPC.

args are arguments which are automatically given to every XML-RPC call before the arguments provides through method_missing.

Methods

Classes