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

ruby-changes:44548

From: nobu <ko1@a...>
Date: Sun, 6 Nov 2016 11:45:18 +0900 (JST)
Subject: [ruby-changes:44548] nobu:r56621 (trunk): e2mmap.rb: remove old definition

nobu	2016-11-06 11:45:14 +0900 (Sun, 06 Nov 2016)

  New Revision: 56621

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

  Log:
    e2mmap.rb: remove old definition
    
    * lib/e2mmap.rb (E2MM.def_exception): remove old definition if
      exists so that works multiple times.

  Modified files:
    trunk/ChangeLog
    trunk/lib/e2mmap.rb
Index: lib/e2mmap.rb
===================================================================
--- lib/e2mmap.rb	(revision 56620)
+++ lib/e2mmap.rb	(revision 56621)
@@ -134,6 +134,7 @@ module Exception2MessageMapper https://github.com/ruby/ruby/blob/trunk/lib/e2mmap.rb#L134
   def E2MM.def_exception(k, n, m, s = StandardError)
     e = Class.new(s)
     E2MM.instance_eval{@MessageMap[[k, e]] = m}
+    k.module_eval {remove_const(n)} if k.const_defined?(n, false)
     k.const_set(n, e)
   end
 
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 56620)
+++ ChangeLog	(revision 56621)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sun Nov  6 11:45:11 2016  Nobuyoshi Nakada  <nobu@r...>
+
+	* lib/e2mmap.rb (E2MM.def_exception): remove old definition if
+	  exists so that works multiple times.
+
 Sun Nov  6 10:03:00 2016  Shugo Maeda  <shugo@r...>
 
 	* test/ruby/test_optimization.rb (test_tailcall_interrupted_by_sigint):

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

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