source: extensions/gsdl-video/trunk/installed/cmdline/lib/ruby/1.8/xmlrpc/marshal.rb@ 18425

Last change on this file since 18425 was 18425, checked in by davidb, 15 years ago

Video extension to Greenstone

File size: 1.6 KB
Line 
1#
2# Marshalling of XML-RPC methodCall and methodResponse
3#
4# Copyright (C) 2001, 2002, 2003 by Michael Neumann ([email protected])
5#
6# $Id: marshal.rb 11708 2007-02-12 23:01:19Z shyouhei $
7#
8
9require "xmlrpc/parser"
10require "xmlrpc/create"
11require "xmlrpc/config"
12require "xmlrpc/utils"
13
14module XMLRPC
15
16 class Marshal
17 include ParserWriterChooseMixin
18
19 # class methods -------------------------------
20
21 class << self
22
23 def dump_call( methodName, *params )
24 new.dump_call( methodName, *params )
25 end
26
27 def dump_response( param )
28 new.dump_response( param )
29 end
30
31 def load_call( stringOrReadable )
32 new.load_call( stringOrReadable )
33 end
34
35 def load_response( stringOrReadable )
36 new.load_response( stringOrReadable )
37 end
38
39 alias dump dump_response
40 alias load load_response
41
42 end # class self
43
44 # instance methods ----------------------------
45
46 def initialize( parser = nil, writer = nil )
47 set_parser( parser )
48 set_writer( writer )
49 end
50
51 def dump_call( methodName, *params )
52 create.methodCall( methodName, *params )
53 end
54
55 def dump_response( param )
56 create.methodResponse( ! param.kind_of?( XMLRPC::FaultException ) , param )
57 end
58
59 ##
60 # returns [ methodname, params ]
61 #
62 def load_call( stringOrReadable )
63 parser.parseMethodCall( stringOrReadable )
64 end
65
66 ##
67 # returns paramOrFault
68 #
69 def load_response( stringOrReadable )
70 parser.parseMethodResponse( stringOrReadable )[1]
71 end
72
73 end # class Marshal
74
75end
76
Note: See TracBrowser for help on using the repository browser.