endpoint method_missing vs override inspect
ericproulx opened this issue · 2 comments
ericproulx commented
#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 commented
This is some advanced ruby-fu, so ... I don't know? :)
ericproulx commented
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.