Sha256: a911cbad534fc574fe1dc0a1f233a13602ebfa448191dcc76c19865a10bcf655

Contents?: true

Size: 632 Bytes

Versions: 7

Compression:

Stored size: 632 Bytes

Contents

unless Hash.method_defined?(:deep_dup)

  class Array
    def deep_dup
      map { |it| it.deep_dup }
    end
  end

  class Hash
    def deep_dup
      each_with_object(dup) do |(key, value), hash|
        hash[key.deep_dup] = value.deep_dup
      end
    end
  end

  class String
    def deep_dup
      self.dup
    end
  end

  class Integer
    def deep_dup
      self
    end
  end

  class Float
    def deep_dup
      self
    end
  end

  class TrueClass
    def deep_dup
      self
    end
  end

  class FalseClass
    def deep_dup
      self
    end
  end

  class NilClass
    def deep_dup
      self
    end
  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
leap_cli-1.9.2 lib/leap_cli/core_ext/deep_dup.rb
leap_cli-1.9.1 lib/leap_cli/core_ext/deep_dup.rb
leap_cli-1.9 lib/leap_cli/core_ext/deep_dup.rb
leap_cli-1.8.1 lib/leap_cli/core_ext/deep_dup.rb
leap_cli-1.8 lib/leap_cli/core_ext/deep_dup.rb
leap_cli-1.7.4 lib/leap_cli/core_ext/deep_dup.rb
leap_cli-1.7.3 lib/leap_cli/core_ext/deep_dup.rb