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

ruby-changes:59375

From: zverok <ko1@a...>
Date: Sun, 22 Dec 2019 23:28:04 +0900 (JST)
Subject: [ruby-changes:59375] d339de9d1a (master): Enhance docs for Module#deprecate_constant

https://git.ruby-lang.org/ruby.git/commit/?id=d339de9d1a

From d339de9d1a11923cd6d435d995ee479d08791720 Mon Sep 17 00:00:00 2001
From: zverok <zverok.offline@g...>
Date: Sat, 21 Dec 2019 23:05:45 +0200
Subject: Enhance docs for Module#deprecate_constant


diff --git a/variable.c b/variable.c
index 4d5c9a6..42c4cb7 100644
--- a/variable.c
+++ b/variable.c
@@ -2992,7 +2992,19 @@ rb_mod_public_constant(int argc, const VALUE *argv, VALUE obj) https://github.com/ruby/ruby/blob/trunk/variable.c#L2992
  *  call-seq:
  *     mod.deprecate_constant(symbol, ...)    => mod
  *
- *  Makes a list of existing constants deprecated.
+ *  Makes a list of existing constants deprecated. Attempt
+ *  to refer to them will produce a warning.
+ *
+ *     module HTTP
+ *       NotFound = Exception.new
+ *       NOT_FOUND = NotFound # previous version of the library used this name
+ *
+ *       deprecate_constant :NOT_FOUND
+ *     end
+ *
+ *     HTTP::NOT_FOUND
+ *     # warning: constant HTTP::NOT_FOUND is deprecated
+ *
  */
 
 VALUE
-- 
cgit v0.10.2


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

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