lib/core/facets/hash/at.rb in facets-2.1.3 vs lib/core/facets/hash/at.rb in facets-2.2.0

- old
+ new

@@ -1,44 +1,14 @@ -# TITLE: -# -# Hash At -# -# SUMMARY: -# -# Alias #at and #/ to #[]. -# -# CREDITS: -# -# - Thomas Sawyer - -# class Hash - # Use division as a fetch notation. + # Use division operator as a fetch notation. + # + # h = {:a=>1} + # h / :a #=> 1 + alias_method :/, :[] - # For greater polymorphism with Array. + # Alias for fetch for greater polymorphism with Array. + # alias_method :at, :[] end - - -# _____ _ -# |_ _|__ ___| |_ -# | |/ _ \/ __| __| -# | | __/\__ \ |_ -# |_|\___||___/\__| -# -=begin test - - require 'test/unit' - - class TestHashAt < Test::Unit::TestCase - - def test_at - h = { :a=>1, :b=>2 } - assert_equal( 1, h.at(:a) ) - assert_equal( 2, h.at(:b) ) - end - end - -=end