From 6b86549df8f6d48eeab3c7b48b3fd9ee02f744ba Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Fri, 24 Jan 2020 09:46:34 +0900 Subject: [PATCH] [DOC] fixed line numbers [ci skip] Fix up the example of const_source_location at 2bde7919a0a8302c344e9bb9ddc217958fcbd3c7. --- object.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/object.c b/object.c index 8acb80c35e..e15b17fa00 100644 --- a/object.c +++ b/object.c @@ -2771,16 +2771,16 @@ rb_mod_const_defined(int argc, VALUE *argv, VALUE mod) * 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) * 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