Class: Hash

Inherits:
Object show all
Defined in:
vendor/bundler/ruby/3.1.0/bundler/gems/sparql-111cba30fecb/lib/sparql/algebra/extensions.rb,
vendor/bundler/ruby/3.1.0/bundler/gems/sxp.rb-7133e42f43bb/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.1.0/bundler/gems/sparql-111cba30fecb/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.1.0/bundler/gems/sparql-111cba30fecb/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:



173
174
175
# File 'vendor/bundler/ruby/3.1.0/bundler/gems/sxp.rb-7133e42f43bb/lib/sxp/extensions.rb', line 173

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