ruby-changes:59791
From: Nobuyoshi <ko1@a...>
Date: Fri, 24 Jan 2020 09:54:38 +0900 (JST)
Subject: [ruby-changes:59791] 6b86549df8 (master): [DOC] fixed line numbers [ci skip]
https://git.ruby-lang.org/ruby.git/commit/?id=6b86549df8 From 6b86549df8f6d48eeab3c7b48b3fd9ee02f744ba Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Fri, 24 Jan 2020 09:46:34 +0900 Subject: [DOC] fixed line numbers [ci skip] Fix up the example of const_source_location at 2bde7919a0a8302c344e9bb9ddc217958fcbd3c7. diff --git a/object.c b/object.c index 8acb80c..e15b17f 100644 --- a/object.c +++ b/object.c @@ -2771,16 +2771,16 @@ rb_mod_const_defined(int argc, VALUE *argv, VALUE mod) https://github.com/ruby/ruby/blob/trunk/object.c#L2771 * by default). * * # test.rb: - * class A + * class A # line 1 * C1 = 1 * C2 = 2 * end * - * module M + * module M # line 6 * C3 = 3 * end * - * class B < A + * class B < A # line 10 * include M * C4 = 4 * end @@ -2789,15 +2789,15 @@ rb_mod_const_defined(int argc, VALUE *argv, VALUE mod) https://github.com/ruby/ruby/blob/trunk/object.c#L2789 * C2 = 8 # constant redefinition; warned yet allowed * end * - * p B.const_source_location('C4') # => ["test.rb", 11] - * p B.const_source_location('C3') # => ["test.rb", 6] + * p B.const_source_location('C4') # => ["test.rb", 12] + * p B.const_source_location('C3') # => ["test.rb", 7] * p B.const_source_location('C1') # => ["test.rb", 2] * * p B.const_source_location('C3', false) # => nil -- don't lookup in ancestors * * p A.const_source_location('C2') # => ["test.rb", 16] -- actual (last) definition place * - * p Object.const_source_location('B') # => ["test.rb", 9] -- top-level constant could be looked through Object + * p Object.const_source_location('B') # => ["test.rb", 10] -- top-level constant could be looked through Object * p Object.const_source_location('A') # => ["test.rb", 1] -- class reopening is NOT considered new definition * * p B.const_source_location('A') # => ["test.rb", 1] -- because Object is in ancestors -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/