Reputation: 11653
I found this great gem 'method finder' that I'm trying to use to help improve my understanding of Ruby, problem is that I don't really get it. It gives this example from the docs. The method 'unknown' is supposed to replace whatever method will give the result in the surrounding code, but what is this example telling us?
>> 10.find_method { |n| n.unknown(3) == 1 }
=> ["Fixnum#%", "Fixnum#<=>", "Fixnum#>>", "Fixnum#[]", "Integer#gcd", "Fixnum#modulo", "Numeric#remainder"]
Upvotes: 3
Views: 128
Reputation: 138012
It's telling you exactly what you asked it for: all the methods on 10
that return 1
when passed 3
:
>> 10 % 3
=> 1
>> 10 <=> 3
=> 1
>> 10 >> 3
=> 1
>> 10[3]
=> 1
>> …
Upvotes: 4