From 6175ca03be6d0d51359f9017123708987d0f5eb7 Mon Sep 17 00:00:00 2001 From: shyouhei Date: Wed, 15 Aug 2007 23:23:39 +0000 Subject: add tag v1_8_5_91 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/tags/v1_8_5_91@13046 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ruby_1_8_5/lib/xmlrpc/marshal.rb | 76 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 ruby_1_8_5/lib/xmlrpc/marshal.rb (limited to 'ruby_1_8_5/lib/xmlrpc/marshal.rb') diff --git a/ruby_1_8_5/lib/xmlrpc/marshal.rb b/ruby_1_8_5/lib/xmlrpc/marshal.rb new file mode 100644 index 0000000000..a4aa620da1 --- /dev/null +++ b/ruby_1_8_5/lib/xmlrpc/marshal.rb @@ -0,0 +1,76 @@ +# +# Marshalling of XML-RPC methodCall and methodResponse +# +# Copyright (C) 2001, 2002, 2003 by Michael Neumann (mneumann@ntecs.de) +# +# $Id: marshal.rb,v 1.1 2003/07/19 10:05:54 matz Exp $ +# + +require "xmlrpc/parser" +require "xmlrpc/create" +require "xmlrpc/config" +require "xmlrpc/utils" + +module XMLRPC + + class Marshal + include ParserWriterChooseMixin + + # class methods ------------------------------- + + class << self + + def dump_call( methodName, *params ) + new.dump_call( methodName, *params ) + end + + def dump_response( param ) + new.dump_response( param ) + end + + def load_call( stringOrReadable ) + new.load_call( stringOrReadable ) + end + + def load_response( stringOrReadable ) + new.load_response( stringOrReadable ) + end + + alias dump dump_response + alias load load_response + + end # class self + + # instance methods ---------------------------- + + def initialize( parser = nil, writer = nil ) + set_parser( parser ) + set_writer( writer ) + end + + def dump_call( methodName, *params ) + create.methodCall( methodName, *params ) + end + + def dump_response( param ) + create.methodResponse( ! param.kind_of?( XMLRPC::FaultException ) , param ) + end + + ## + # returns [ methodname, params ] + # + def load_call( stringOrReadable ) + parser.parseMethodCall( stringOrReadable ) + end + + ## + # returns paramOrFault + # + def load_response( stringOrReadable ) + parser.parseMethodResponse( stringOrReadable )[1] + end + + end # class Marshal + +end + -- cgit v1.2.3