Class: Hash

Inherits:
Object show all
Defined in:
vendor/bundler/ruby/3.3.0/bundler/gems/sparql-796d3be4aa08/lib/sparql/algebra/extensions.rb,
vendor/bundler/ruby/3.3.0/bundler/gems/sxp.rb-7a771a32c5fe/lib/sxp/extensions.rb

Overview

Extensions for Ruby's Hash class.

Direct Known Subclasses

JSON::LD::BlankNodeMapper

Instance Method Summary collapse

Instance Method Details

#deep_dupObject

Deep duplicate



241
242
243
# File 'vendor/bundler/ruby/3.3.0/bundler/gems/sparql-796d3be4aa08/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 'vendor/bundler/ruby/3.3.0/bundler/gems/sparql-796d3be4aa08/lib/sparql/algebra/extensions.rb', line 235

def optimize(**options)
  self.deep_dup
end

#to_sxp(**options) ⇒ String

Returns the SXP representation of this object.

Returns:



189
190
191
# File 'vendor/bundler/ruby/3.3.0/bundler/gems/sxp.rb-7a771a32c5fe/lib/sxp/extensions.rb', line 189

def to_sxp(**options)
  to_a.to_sxp(**options)
end