больше обходного пути, чем реальное решение (вы попросили метод), но я бы посоветовал использовать ri doc . Если Rdoc / Ri Doc был сгенерирован должным образом, в документе указывается исходный камень.
для перечисления всех классов, известных ri:
ri -l
чтобы получить документацию для определенного класса или модуля:
ri ClassName
чтобы получить информацию о методе:
ri ClassName#instance_method_name
ri ClassName#class_method_name
Если хотите, есть гем под названием ri_for , который позволяет вам проверять документ ri
во время выполнения, который поможет вам в консоли. Пример вывода в сеансе irb:
>> require 'ri_for'
=> true
>> String.desc_class
begin RI
String < Object
------------------------------------------------------------------------------
Includes:
Diff::LCS (from gem diff-lcs-1.1.3)
(from gem diff-lcs-1.1.3)
------------------------------------------------------------------------------
Includes Diff::LCS into String.
------------------------------------------------------------------------------
(from gem rake-0.8.7)
------------------------------------------------------------------------------
User defined methods to be added to String.
------------------------------------------------------------------------------
Instance methods:
ext
pathmap
pathmap_explode
pathmap_partial
pathmap_replace
(from gem treetop-1.4.10)
------------------------------------------------------------------------------
Instance methods:
blank?
column_of
indent
line_of
tabto
treetop_camelize
end ri
String
non inherited methods:
%, *, +, <<, <=>, ==, ===, =~, [], []=, ascii_only?, blank?, bytes, bytesize, capitalize, capitalize!, casecmp, center, chars, chomp, chomp!, chop, chop!, chr, clear, codepoints, column_of, concat, count, crypt, delete, delete!, downcase, downcase!, dump, each_byte, each_char, each_codepoint, each_line, empty?, encode, encode!, encoding, end_with?, eql?, force_encoding, getbyte, gsub, gsub!, hash, hex, include?, indent, index, insert, inspect, intern, length, line_of, lines, ljust, lstrip, lstrip!, match, next, next!, oct, ord, partition, replace, reverse, reverse!, rindex, rjust, rpartition, rstrip, rstrip!, scan, setbyte, size, slice, slice!, split, squeeze, squeeze!, start_with?, strip, strip!, sub, sub!, succ, succ!, sum, swapcase, swapcase!, tabto, to_c, to_f, to_i, to_r, to_s, to_str, to_sym, tr, tr!, tr_s, tr_s!, treetop_camelize, unpack, upcase, upcase!, upto, valid_encoding?
non inherited class methods:
try_convert
=> nil