Sha256: 08d069d486cbe8192bc68c05862493b0840841964a0ff6d28e1cd7dd0da692e9

Contents?: true

Size: 489 Bytes

Versions: 1

Compression:

Stored size: 489 Bytes

Contents

require 'nano/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

1 entries across 1 versions & 1 rubygems

Version Path
facets-0.9.0 lib/nano/hash/graph.rb