Class: Hash

Inherits:
Object show all
Defined in:
lib/sparql/algebra/extensions.rb

Overview

Extensions for Ruby’s Hash class.

Instance Method Summary collapse

Instance Method Details

#deep_dupObject

Deep duplicate



241
242
243
# File 'lib/sparql/algebra/extensions.rb', line 241

def deep_dup
  inject({}) {|memo, (k, v)| memo.merge(k => v.deep_dup)}
end

#optimize(**options) ⇒ Hash

A duplicate of this hash.

Returns:

  • (Hash)

    a copy of self

See Also:



235
236
237
# File 'lib/sparql/algebra/extensions.rb', line 235

def optimize(**options)
  self.deep_dup
end