例:
irb(メイン):001:0> "hello" .suggest_method( "HELLO") => ["upcase"、 "swapcase"] irb(メイン):002:0> "hello" .suggest_method( "Hello") =>「資本化」 irb(メイン):007:0> Date.parse('13 Sep 2009 ')。suggest_method(256)#プログラマーズデー =>「yday」 irb(メイン):009:0> 1.01.suggest_method(1) => ["prec_i"、 "round"、 "truncate"、 "to_i"、 "to_int"、 "floor"] irb(メイン):010:0> 1.01.suggest_method(2) => "ceil"
MethodFinderでは、いくつかの結果を考慮することができます。たとえば、次のとおりです。
irb(メイン):011:0> MethodFinder.suggest_method(-1.01 => -2、1.01 => 1) =>「床」 irb(メイン):001:0> MethodFinder.suggest_method(-1.01 => -1、1.01 => 1) => ["to_int"、 "round"、 "to_i"、 "prec_i"、 "truncate"]
更新:
引数付きのセレクター
irb(メイン):005:0> "hello" .suggest_method( "hello world"、 "world") => ["+"、 "concat"、 "<<"] irb(メイン):003:0> MethodFinder.suggest_method([2、4、2]、[[2]、[2、2]、2]) ./method_finder.rb:20:警告:Fixnumをシンボルとして使用しないでください => "*"
githubの船員: github.com/mholub/method_finder/tree/master
更新:
これは自転車です。たとえばandy@nobugs.orgのように、多くの人がすでに類似物を書いています。
www.nobugs.org/developer/ruby/method_finder.html
拡張バージョン:
redhanded.hobix.com/inspect/stickItInYourIrbrcMethodfinder.html