Sha256: 3bf071be912c19de43fa6a824290389934525254ec2a68f63b37938df11b27ce

Contents?: true

Size: 748 Bytes

Versions: 23

Compression:

Stored size: 748 Bytes

Contents

require 'cgi'

module Aws
  # @api private
  module Util
    class << self

      def deep_merge(left, right)
        case left
        when Hash then left.merge(right) { |key, v1, v2| deep_merge(v1, v2) }
        when Array then right + left
        else right
        end
      end

      def copy_hash(hash)
        if Hash === hash
          deep_copy(hash)
        else
          raise ArgumentError, "expected hash, got `#{hash.class}`"
        end
      end

      def deep_copy(obj)
        case obj
        when Hash
          obj.inject({}) do |h, (k,v)|
            h[k] = deep_copy(v)
            h
          end
        when Array
          obj.map { |v| deep_copy(v) }
        else
          v
        end
      end
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
aws-sdk-core-3.3.0 lib/aws-sdk-core/util.rb
aws-sdk-core-3.2.1 lib/aws-sdk-core/util.rb
aws-sdk-core-3.2.0 lib/aws-sdk-core/util.rb
aws-sdk-core-3.1.0 lib/aws-sdk-core/util.rb
aws-sdk-core-3.0.0 lib/aws-sdk-core/util.rb
aws-sdk-core-3.0.0.rc20 lib/aws-sdk-core/util.rb
aws-sdk-core-3.0.0.rc19 lib/aws-sdk-core/util.rb
aws-sdk-core-3.0.0.rc18 lib/aws-sdk-core/util.rb
aws-sdk-core-3.0.0.rc17 lib/aws-sdk-core/util.rb
aws-sdk-core-3.0.0.rc16 lib/aws-sdk-core/util.rb
aws-sdk-core-3.0.0.rc15 lib/aws-sdk-core/util.rb
aws-sdk-core-3.0.0.rc14 lib/aws-sdk-core/util.rb
aws-sdk-core-3.0.0.rc13 lib/aws-sdk-core/util.rb
aws-sdk-core-3.0.0.rc12 lib/aws-sdk-core/util.rb
aws-sdk-core-3.0.0.rc11 lib/aws-sdk-core/util.rb
aws-sdk-core-3.0.0.rc10 lib/aws-sdk-core/util.rb
aws-sdk-core-3.0.0.rc9 lib/aws-sdk-core/util.rb
aws-sdk-core-3.0.0.rc7 lib/aws-sdk-core/util.rb
aws-sdk-core-3.0.0.rc6 lib/aws-sdk-core/util.rb
aws-sdk-core-3.0.0.rc5 lib/aws-sdk-core/util.rb