Sha256: 9328ef5fb94eec1e63cffe388de06b7a7ec8d3b77dd6fd2f010e0e41aab7d08f
Contents?: true
Size: 496 Bytes
Versions: 3
Compression:
Stored size: 496 Bytes
Contents
require 'facets/core/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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
facets-1.8.51 | lib/facets/core/hash/graph.rb |
facets-1.8.49 | lib/facets/core/hash/graph.rb |
facets-1.8.54 | lib/facets/core/hash/graph.rb |