ruby-changes:61010
From: Nobuyoshi <ko1@a...>
Date: Tue, 5 May 2020 14:04:31 +0900 (JST)
Subject: [ruby-changes:61010] f0b5629c8c (master): envutil.rb: Also alias to #name
https://git.ruby-lang.org/ruby.git/commit/?id=f0b5629c8c From f0b5629c8cc485753ad0af2ed414bc6ae70c629f Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Tue, 5 May 2020 13:53:44 +0900 Subject: envutil.rb: Also alias to #name diff --git a/tool/lib/envutil.rb b/tool/lib/envutil.rb index 07d76c0..0dd86df 100644 --- a/tool/lib/envutil.rb +++ b/tool/lib/envutil.rb @@ -244,7 +244,11 @@ module EnvUtil https://github.com/ruby/ruby/blob/trunk/tool/lib/envutil.rb#L244 def labeled_module(name, &block) Module.new do - singleton_class.class_eval {define_method(:to_s) {name}; alias inspect to_s} + singleton_class.class_eval { + define_method(:to_s) {name} + alias inspect to_s + alias name to_s + } class_eval(&block) if block end end @@ -252,7 +256,11 @@ module EnvUtil https://github.com/ruby/ruby/blob/trunk/tool/lib/envutil.rb#L256 def labeled_class(name, superclass = Object, &block) Class.new(superclass) do - singleton_class.class_eval {define_method(:to_s) {name}; alias inspect to_s} + singleton_class.class_eval { + define_method(:to_s) {name} + alias inspect to_s + alias name to_s + } class_eval(&block) if block end end -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/