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
