Ruby: Check a method can be used on an object