Sha256: 975012a88cb573a31b2d9cf3d7798eec7871dd5412c211e53985dcab7249f010

Contents?: true

Size: 409 Bytes

Versions: 4

Compression:

Stored size: 409 Bytes

Contents

require 'ostruct'
require 'facets/module/basename'

class Hash

  #
  def to_hash
    dup
  end unless method_defined?(:to_hash)

  #
  def rekey(&block)
    h = {}
    if block
      each{|k,v| h[block[k]] = v }
    else
      each{|k,v| h[k.to_sym] = v }
    end
    h
  end unless method_defined?(:rekey)

end

class OpenStruct

  #
  def to_hash
    @table.dup
  end unless method_defined?(:to_hash)

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
malt-0.3.0 lib/malt/core_ext.rb
malt-0.2.0 lib/malt/core_ext.rb
malt-0.1.1 lib/malt/core_ext.rb
malt-0.1.0 lib/malt/core_ext.rb