Skip to content

Commit edff523

Browse files
osyoyunobu
authored andcommitted
[DOC] Describe new return value of source_location
Proc#source_location, Method#source_location and UnboundMethod#source_location carry more information since 073c4e1. https://bugs.ruby-lang.org/issues/6012 ruby#12539
1 parent c52f4ee commit edff523

1 file changed

Lines changed: 20 additions & 6 deletions

File tree

proc.c

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1394,10 +1394,17 @@ rb_iseq_location(const rb_iseq_t *iseq)
13941394

13951395
/*
13961396
* call-seq:
1397-
* prc.source_location -> [String, Integer]
1397+
* prc.source_location -> [String, Integer, Integer, Integer, Integer]
13981398
*
1399-
* Returns the Ruby source filename and line number containing this proc
1400-
* or +nil+ if this proc was not defined in Ruby (i.e. native).
1399+
* Returns the location where the Proc was defined.
1400+
* The returned Array contains:
1401+
* (1) the Ruby source filename
1402+
* (2) the line number where the definition starts
1403+
* (3) the column number where the definition starts
1404+
* (4) the line number where the definition ends
1405+
* (5) the column number where the definitions ends
1406+
*
1407+
* This method will return +nil+ if the Proc was not defined in Ruby (i.e. native).
14011408
*/
14021409

14031410
VALUE
@@ -3056,10 +3063,17 @@ rb_method_entry_location(const rb_method_entry_t *me)
30563063

30573064
/*
30583065
* call-seq:
3059-
* meth.source_location -> [String, Integer]
3066+
* meth.source_location -> [String, Integer, Integer, Integer, Integer]
3067+
*
3068+
* Returns the location where the method was defined.
3069+
* The returned Array contains:
3070+
* (1) the Ruby source filename
3071+
* (2) the line number where the definition starts
3072+
* (3) the column number where the definition starts
3073+
* (4) the line number where the definition ends
3074+
* (5) the column number where the definitions ends
30603075
*
3061-
* Returns the Ruby source filename and line number containing this method
3062-
* or nil if this method was not defined in Ruby (i.e. native).
3076+
* This method will return +nil+ if the method was not defined in Ruby (i.e. native).
30633077
*/
30643078

30653079
VALUE

0 commit comments

Comments
 (0)