diff options
author | nahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-11-08 09:52:42 +0000 |
---|---|---|
committer | nahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-11-08 09:52:42 +0000 |
commit | b7931c40fee8ec76c2ef0398f228e034d7ff64e4 (patch) | |
tree | 4455d91a96cc91f03858ef6c517e9b7d7dbbf119 /lib/soap/mapping | |
parent | 2c35c4254e36cb3c59acfb50b738930c49cfd3af (diff) | |
download | ruby-b7931c40fee8ec76c2ef0398f228e034d7ff64e4.tar.gz |
* test/wsdl/raa/*: add new testcase for WSDL loading, parsing and reading.
* test/soap/marshal/*: backport from soap4r/1.5.1. all differences are for
ruby/1.6.
* lib/soap/*: backport from soap4r/1.5.1. all differences are for ruby/1.6.
* lib/wsdl/data.rb, lib/wsdl/xmlSchema/data.rb: move definition of
ArrayTypeAttrName from ::WSDL::XMLSchema::* to ::WSDL::*. [ruby-talk:84813]
* lib/wsdl/soap/definitions.rb: element name typo in custom exception struct
definition which is needed for wsdlDriver; camelCase -> underscore_name.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4925 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/soap/mapping')
-rw-r--r-- | lib/soap/mapping/factory.rb | 23 | ||||
-rw-r--r-- | lib/soap/mapping/registry.rb | 19 |
2 files changed, 36 insertions, 6 deletions
diff --git a/lib/soap/mapping/factory.rb b/lib/soap/mapping/factory.rb index 92ed194a42..631c161134 100644 --- a/lib/soap/mapping/factory.rb +++ b/lib/soap/mapping/factory.rb @@ -44,10 +44,29 @@ class Factory klass.allocate end else + MARSHAL_TAG = { + String => ['"', 1], + Regexp => ['/', 2], + Array => ['[', 1], + Hash => ['{', 1] + } def create_empty_object(klass) + if klass <= Struct + name = klass.name + return ::Marshal.load(sprintf("\004\006S:%c%s\000", name.length + 5, name)) + end + if MARSHAL_TAG.has_key?(klass) + tag, terminate = MARSHAL_TAG[klass] + return ::Marshal.load(sprintf("\004\006%s%s", tag, "\000" * terminate)) + end + MARSHAL_TAG.each do |k, v| + if klass < k + name = klass.name + tag, terminate = v + return ::Marshal.load(sprintf("\004\006C:%c%s%s%s", name.length + 5, name, tag, "\000" * terminate)) + end + end name = klass.name - # Below line is from TANAKA, Akira's amarshal.rb. - # See http://cvs.m17n.org/cgi-bin/viewcvs/amarshal/?cvsroot=ruby ::Marshal.load(sprintf("\004\006o:%c%s\000", name.length + 5, name)) end end diff --git a/lib/soap/mapping/registry.rb b/lib/soap/mapping/registry.rb index bdf14d4fc6..e98c98a6d4 100644 --- a/lib/soap/mapping/registry.rb +++ b/lib/soap/mapping/registry.rb @@ -426,10 +426,21 @@ private Mapping.set_instance_vars(obj, vars) end - def addextend2obj(obj, attr) - return unless attr - attr.split(/ /).reverse_each do |mstr| - obj.extend(Mapping.class_from_name(mstr)) + if RUBY_VERSION >= '1.8.0' + def addextend2obj(obj, attr) + return unless attr + attr.split(/ /).reverse_each do |mstr| + obj.extend(Mapping.class_from_name(mstr)) + end + end + else + # (class < false; self; end).ancestors includes "TrueClass" under 1.6... + def addextend2obj(obj, attr) + return unless attr + attr.split(/ /).reverse_each do |mstr| + m = Mapping.class_from_name(mstr) + obj.extend(m) if m.class == Module + end end end |