-
Notifications
You must be signed in to change notification settings - Fork 62
-
I wonder if anything can be improved here:
irb> im.bands
=> 3
irb> im.method(:bands)
=> #<Method: Vips::Image#bands>
irb> im.hist_find
=> #<Image 256x1 uint, 3 bands, histogram>
irb> im.method(:hist_find)
NameError: undefined method `hist_find' for class `Vips::Image'
I know it's something done via the method_missing
but it's weird that only a half of methods have the issue. I guess it also confuses the did_you_mean
built-in gem -- it can't to give an advice sometimes because the method you want is somewhere deep in Operations
.
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 1 comment
-
Hiya, sorry, I've no idea. Does anyone have any suggestions?
The ruby-vips Image
class implements method_missing
, respond_to_missing?
and respond_to?
, but perhaps there's something more or different we should be doing?
https://github.com/libvips/ruby-vips/blob/master/lib/vips/image.rb#L193-L230
I think implementing respond_to_missing?
is supposed to be enough to make #method
function, but it's obviously not working for us for some reason.
https://thoughtbot.com/blog/always-define-respond-to-missing-when-overriding
Beta Was this translation helpful? Give feedback.