irb (main): 001: 0> "hello" .suggest_method ("HELLO") => ["upcase", "swapcase"] irb (main): 002: 0> "hello" .suggest_method ("Hello") => "capitalize" irb (main): 007: 0> Date.parse ('13 Sep 2009 '). suggest_method (256) # Programmer's Day => "yday" irb (main): 009: 0> 1.01.suggest_method (1) => ["prec_i", "round", "truncate", "to_i", "to_int", "floor"] irb (main): 010: 0> 1.01.suggest_method (2) => "ceil"
irb (main): 011: 0> MethodFinder.suggest_method (-1.01 => -2, 1.01 => 1) => "floor" irb (main): 001: 0> MethodFinder.suggest_method (-1.01 => -1, 1.01 => 1) => ["to_int", "round", "to_i", "prec_i", "truncate"]
irb (main): 005: 0> "hello" .suggest_method ("hello world", "world") => ["+", "concat", "<<"] irb (main): 003: 0> MethodFinder.suggest_method ([2, 4, 2], [[2], [2, 2], 2]) ./method_finder.rb:20: warning: do not use Fixnums as Symbols => "*"
Source: https://habr.com/ru/post/55544/
All Articles