Sha256: 4fc0d9146974ccdd04e9249263daa37cad4eabe12ad337d721bcbad77952c21f

Contents?: true

Size: 676 Bytes

Versions: 2

Compression:

Stored size: 676 Bytes

Contents

require 'soap/mapping/mapping'
require 'soap/mapping/registry'

def needspatch
  SOAP::Mapping.set_attributes(a=[], :x=>10)
  a != [10]
rescue Exception => e
  true
end
  
if needspatch

  # Apply mapping patch only if it has not already been applied.
  class << SOAP::Mapping
    alias set_attributes_old set_attributes
    def set_attributes(obj, values)
      if not obj.is_a?(::SOAP::Mapping::Object) and obj.kind_of?(Array)
        values.each do |key, value|
          if value.kind_of?(Array)
            obj.concat(value)
          else
            obj << value
          end
        end
      else
        set_attributes_old(obj, values)
      end
    end
  end

end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
soapex-0.1 lib/soapex/mapping.rb
ysm4r-0.1 lib/soapex/mapping.rb