lib/facet/module/rename_method.rb in facets-1.1.0 vs lib/facet/module/rename_method.rb in facets-1.2.0
- old
+ new
@@ -1,38 +2 @@
-class Module
- private
- # Aliases a method and undefines the original.
- #
- # rename_method( :to_method, :from_method )
- #
- def rename_method( to_sym, from_sym )
- raise ArgumentError, "method #{from_sym} does not exist" unless method_defined?( from_sym )
- alias_method( to_sym, from_sym )
- undef_method( from_sym )
- end
-end
-
-
-# _____ _
-# |_ _|__ ___| |_
-# | |/ _ \/ __| __|
-# | | __/\__ \ |_
-# |_|\___||___/\__|
-#
-=begin test
-
- require 'test/unit'
-
- class TCModule < Test::Unit::TestCase
-
- def a; "A" ; end
-
- rename_method :b, :a
-
- def test_rename_method
- assert( ! respond_to?( :a ) )
- assert( respond_to?( :b ) )
- end
-
- end
-
-=end
+require 'facets/core/module/rename_method.rb'
\ No newline at end of file