lib/soap/mapping/encodedregistry.rb in rubyjedi-soap4r-1.5.8.20100619003610 vs lib/soap/mapping/encodedregistry.rb in rubyjedi-soap4r-2.0.2.1
- old
+ new
@@ -1,6 +1,6 @@
-# encoding: ASCII-8BIT
+# encoding: UTF-8
# SOAP4R - encoded mapping registry.
# Copyright (C) 2000-2007 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
# This program is copyrighted free software by NAKAMURA, Hiroshi. You can
# redistribute it and/or modify it under the same terms of Ruby's license;
@@ -10,12 +10,10 @@
require 'soap/baseData'
require 'soap/mapping/mapping'
require 'soap/mapping/typeMap'
require 'soap/mapping/factory'
require 'soap/mapping/rubytypeFactory'
-
-
module SOAP
module Mapping
# Inner class to pass an exception.
@@ -404,25 +402,29 @@
end
def addextend2obj(obj, attr)
return unless attr
attr.split(/ /).reverse_each do |mstr|
- obj.extend(Mapping.module_from_name(mstr))
+ ext_module = Mapping.module_from_name(mstr)
+ return if ext_module.is_a?(Class) # RubyJedi: Apparently needed for Ruby 2.1 and above?
+ obj.extend(ext_module)
end
end
def addextend2soap(node, obj)
- return if obj.is_a?(Symbol) or obj.is_a?(Fixnum)
+ return if [Symbol, Fixnum, Bignum, Float].any?{ |c| obj.is_a?(c) }
list = (class << obj; self; end).ancestors - obj.class.ancestors
- unless list.empty?
- node.extraattr[RubyExtendName] = list.collect { |c|
- name = c.name
- if name.nil? or name.empty?
- raise TypeError.new("singleton can't be dumped #{ obj }")
- end
- name
- }.join(" ")
- end
+ list = list.reject{|c| c.class == Class } ## As of Ruby 2.1 Singleton Classes are now included in the ancestry. Need to filter those out here.
+
+ return if list.empty?
+ extra_attrs = list.collect { |c|
+ name = c.name
+ if name.nil? or name.empty?
+ raise TypeError.new("singleton can't be dumped #{ obj }")
+ end
+ name
+ }.join(" ")
+ node.extraattr[RubyExtendName] = extra_attrs
end
def stubobj2soap(obj, definition)
case obj
when ::Array