Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Not all Image methods are obtainable with .method #283

Nakilon started this conversation in General
Discussion options

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.

You must be logged in to vote

Replies: 1 comment

Comment options

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

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants

AltStyle によって変換されたページ (->オリジナル) /