Taking a look at the ViewComponent docs, call
is not part of the public interface. So that’s what’s happening: Dry::Monads::Do::All
is expected a call method and you don’t have one.
Furthermore, I don’t think mixing in do-notation into a ViewComponent is a good idea. It’s meant for Operation objects that behave like functions, and isn’t really used in view logic that I’ve seen. The do-notation wraps every method defined with code that intercepts yield
, which is a bad idea in views, yield
is usually used for something.
The workaround you’ve already found, using include Dry::Monads::Do.for
for specific methods should be safe to do. But if wrapping a helper method in do-notation is necessary here, then perhaps that would be better off extracted into a separate Operation.