Sha256: f946a4305f2b61abc55921d7f292eca872d9295e238183c2c386858b656ccd8f
Contents?: true
Size: 490 Bytes
Versions: 22
Compression:
Stored size: 490 Bytes
Contents
require 'facet/enumerable/graph' class Hash # As with Enumerable#graph but acts in place. def graph!( &blk ) self.replace( graph( &blk ) ) end end # _____ _ # |_ _|__ ___| |_ # | |/ _ \/ __| __| # | | __/\__ \ |_ # |_|\___||___/\__| # =begin test require 'test/unit' class TCHash < Test::Unit::TestCase def test_graph h = {:a=>1,:b=>2,:c=>3} h.graph!{ |k,v| [v, v*v] } assert_equal( {1=>1, 2=>4, 3=>9}, h ) end end =end
Version data entries
22 entries across 22 versions & 1 rubygems