Class: Hash

Inherits:
Object show all
Defined in:
vendor/bundler/ruby/3.0.0/bundler/gems/sparql-ffa592c8f275/lib/sparql/algebra/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



239
240
241
# File 'vendor/bundler/ruby/3.0.0/bundler/gems/sparql-ffa592c8f275/lib/sparql/algebra/extensions.rb', line 239

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:



233
234
235
# File 'vendor/bundler/ruby/3.0.0/bundler/gems/sparql-ffa592c8f275/lib/sparql/algebra/extensions.rb', line 233

def optimize(**options)
  self.deep_dup
end

#to_sxpObject



226
# File 'vendor/bundler/ruby/3.0.0/bundler/gems/sparql-ffa592c8f275/lib/sparql/algebra/extensions.rb', line 226

def to_sxp; to_sxp_bin; end

#to_sxp_binString

Returns the SXP representation of this object, defaults to self.

Returns:



223
224
225
# File 'vendor/bundler/ruby/3.0.0/bundler/gems/sparql-ffa592c8f275/lib/sparql/algebra/extensions.rb', line 223

def to_sxp_bin
  to_a.to_sxp_bin
end