[前][次][番号順一覧][スレッド一覧]

ruby-changes:41900

From: nobu <ko1@a...>
Date: Mon, 29 Feb 2016 21:21:29 +0900 (JST)
Subject: [ruby-changes:41900] nobu:r53974 (trunk): fileutils.rb: LowMethods aliases

nobu	2016-02-29 21:22:17 +0900 (Mon, 29 Feb 2016)

  New Revision: 53974

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=53974

  Log:
    fileutils.rb: LowMethods aliases
    
    * lib/fileutils.rb (LowMethods): make alias methods instead of
      eval for each methods.

  Modified files:
    trunk/lib/fileutils.rb
Index: lib/fileutils.rb
===================================================================
--- lib/fileutils.rb	(revision 53973)
+++ lib/fileutils.rb	(revision 53974)
@@ -1674,8 +1674,9 @@ module FileUtils https://github.com/ruby/ruby/blob/trunk/lib/fileutils.rb#L1674
 
   LOW_METHODS = singleton_methods(false) - collect_method(:noop).map(&:intern)
   module LowMethods
-    module_eval("private\n" + ::FileUtils::LOW_METHODS.map {|name| "def #{name}(*)end"}.join("\n"),
-                __FILE__, __LINE__)
+    private
+    def _do_nothing(*)end
+    ::FileUtils::LOW_METHODS.map {|name| alias_method name, :_do_nothing}
   end
 
   METHODS = singleton_methods() - [:private_module_function,

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]