Skip to content

Commit f77290c

Browse files
committed
[DOC] Improve docs for Method#source_location
1 parent 0765e35 commit f77290c

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

proc.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3211,10 +3211,18 @@ rb_method_entry_location(const rb_method_entry_t *me)
32113211

32123212
/*
32133213
* call-seq:
3214-
* meth.source_location -> [String, Integer]
3214+
* source_location -> location
32153215
*
3216-
* Returns the Ruby source filename and line number containing this method
3217-
* or nil if this method was not defined in Ruby (i.e. native).
3216+
* Returns a two-element array containing the Ruby source filename
3217+
* as a string and the line number integer where +self+ is defined:
3218+
*
3219+
* def greeting = "hello"
3220+
* method(:greeting).source_location # => ["test.rb", 1]
3221+
*
3222+
* Returns nil if +self+ is not a method defined in Ruby (i.e. defined
3223+
* using native code):
3224+
*
3225+
* Kernel.method(:puts).source_location # => nil
32183226
*/
32193227

32203228
VALUE

0 commit comments

Comments
 (0)