2011-10-29 3 views

답변

1
~$ ri 

Enter the method name you want to look up. 
You can use tab to autocomplete. 
Enter a blank line to exit. 

>> to_s 

= .to_s 

(from gem actionpack-3.1.0.rc6) 
=== Implementation from ActionDispatch::RemoteIp::RemoteIpGetter 
------------------------------------------------------------------------------ 
    to_s() 

------------------------------------------------------------------------------ 


(from gem actionpack-3.1.0.rc6) 
=== Implementation from ActionView::FileSystemResolver 
------------------------------------------------------------------------------ 
    to_s() 

------------------------------------------------------------------------------ 


(from gem actionpack-3.1.0.rc6) 
=== Implementation from ActionView::FixtureResolver 
------------------------------------------------------------------------------ 
    to_s() 
1

편집 | 이 대답은 당신이 당신의 질문을 편집 한 이후로는 의미가 없습니다;) 맥락에서 벗어났습니다.

매우 효율적인 방법입니다. 당신이 필요할 것 왜 개인적으로 볼 수 없습니다 :

class ClassEnumerator 
    def each(&block) 
    ObjectSpace.each_object(Class, &block) 
    end 

    include Enumerable 
end 

ClassEnumerator.new.select { |klass| klass.instance_methods.include?(:merge) } 

이것은 #merge를 구현하는 모든 클래스를 찾아야한다.

pry(main)> ClassEnumerator.new.select { |klass| klass.instance_methods.include?(:merge) } 
=> [OptionParser::CompletingHash, 
OptionParser::OptionMap, 
Hash, 
Gem::Dependency, 
Psych::Omap, 
Psych::Set, 
URI::MailTo, 
URI::LDAPS, 
URI::LDAP, 
CodeRay::CaseIgnoringWordList, 
CodeRay::WordList, 
URI::HTTPS, 
URI::HTTP, 
URI::FTP, 
URI::Generic] 
pry(main)> 
0

또한 ri METHOD_NAME 당신은 당신이 원하는 무엇의 예를 들어 줄 수 man ri

관련 문제