Sha256: 3ea4f41919db2897ccadd7994f45307878d68be6c0f899129a870bc02bf0c81f

Contents?: true

Size: 373 Bytes

Versions: 3

Compression:

Stored size: 373 Bytes

Contents

class Hash
  def copy_without_destroy
    a = {}
    self.each {|key,val| a[key]=val unless key.to_s == "_destroy"}
    a
  end

  def << (hash)
    hash.each{|a,b| self[a]=b}
  end

  def map(&block)
    val = {}
    self.each {|a,b| val << block.call(a,b)}
    val
  end

  def map_ary(&block)
    val = []
    self.each{|a,b| val << block.call(a,b)}
    val
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
da_huangs_ruby_extensions-0.0.5 lib/hash_ext.rb
da_huangs_ruby_extensions-0.0.4 lib/hash.rb
da_huangs_ruby_extensions-0.0.1 lib/hash.rb