mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
Let the docs of base_label and label be similar
This commit is contained in:
parent
dadaa1142f
commit
3b4dacf2ed
1 changed files with 24 additions and 7 deletions
|
@ -287,15 +287,14 @@ location_label(rb_backtrace_location_t *loc)
|
||||||
* 1.times do
|
* 1.times do
|
||||||
* puts caller_locations(0).first.label
|
* puts caller_locations(0).first.label
|
||||||
* end
|
* end
|
||||||
*
|
|
||||||
* end
|
* end
|
||||||
* end
|
* end
|
||||||
*
|
*
|
||||||
* The result of calling +foo+ is this:
|
* The result of calling +foo+ is this:
|
||||||
*
|
*
|
||||||
* label: foo
|
* foo
|
||||||
* label: block in foo
|
* block in foo
|
||||||
* label: block (2 levels) in foo
|
* block (2 levels) in foo
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static VALUE
|
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.
|
||||||
*
|
*
|
||||||
* For example, if the label is `foo`, this method returns `foo` as well, but if
|
* Consider the following example:
|
||||||
* the label is +rescue in foo+, this method returns just +foo+.
|
*
|
||||||
|
* 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:
|
||||||
|
*
|
||||||
|
* foo
|
||||||
|
* foo
|
||||||
|
* foo
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
location_base_label_m(VALUE self)
|
location_base_label_m(VALUE self)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue