Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

endpoint method_missing vs override inspect #2398

Closed
ericproulx opened this issue Jan 1, 2024 · 2 comments · Fixed by #2444
Closed

endpoint method_missing vs override inspect #2398

ericproulx opened this issue Jan 1, 2024 · 2 comments · Fixed by #2444

Comments

@ericproulx
Copy link
Contributor

#2236 has added a method_missing to override the NoMethodError message since it was huge inside any endpoints. I found that it's been fixed in ruby 3.3 and the solution was to not use inspect on undefined method. I think that instead of using a method_missing strategy we could simply override endpoint's inspect method like this:

def inspect
  "#{self.class} in `#{route.origin}' endpoint"
end

and we would achieve the same thing.
Any thoughts ?

Happy New Year :)

@dblock
Copy link
Member

dblock commented Jan 2, 2024

This is some advanced ruby-fu, so ... I don't know? :)

@ericproulx
Copy link
Contributor Author

This is some advanced ruby-fu, so ... I don't know? :)

IMO, I would just override the inspect. It's faster than passing by method_missing which is notoriously known to be slow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants