diff options
author | Xavier Noria <fxn@hashref.com> | 2024-03-25 11:09:14 +0100 |
---|---|---|
committer | Jean Boussier <jean.boussier@gmail.com> | 2024-03-25 14:13:05 +0100 |
commit | 3b4dacf2ede0dafbcf942ac696439237f8b31dc6 (patch) | |
tree | f10cecfb08d8f0c85030b411c0776cdae3b8dc99 | |
parent | dadaa1142fc89d9752e9454f99b0b4d32068ef41 (diff) |
Let the docs of base_label and label be similar
-rw-r--r-- | vm_backtrace.c | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/vm_backtrace.c b/vm_backtrace.c index 9f004df792..11b26adbf4 100644 --- a/vm_backtrace.c +++ b/vm_backtrace.c @@ -287,15 +287,14 @@ location_label(rb_backtrace_location_t *loc) * 1.times do * puts caller_locations(0).first.label * end - * * end * end * * The result of calling +foo+ is this: * - * label: foo - * label: block in foo - * label: block (2 levels) in foo + * foo + * block in foo + * block (2 levels) in foo * */ static VALUE @@ -315,10 +314,28 @@ location_base_label(rb_backtrace_location_t *loc) } /* - * Returns the label of this frame without decoration. + * Returns the base label of this frame, which is usually equal to the label, + * without decoration. + * + * Consider the following example: + * + * def foo + * puts caller_locations(0).first.base_label + * + * 1.times do + * puts caller_locations(0).first.base_label + * + * 1.times do + * puts caller_locations(0).first.base_label + * end + * end + * end + * + * The result of calling +foo+ is this: * - * For example, if the label is `foo`, this method returns `foo` as well, but if - * the label is +rescue in foo+, this method returns just +foo+. + * foo + * foo + * foo */ static VALUE location_base_label_m(VALUE self) |