For named auth classes, internal request subclass is still anonymous:
class RodauthMain < Rodauth::Auth
end
class RodauthApp < Roda
plugin :rodauth, auth_class: RodauthMain do
enable :internal_request
end
end
RodauthMain.internal_request_eval do
self.class #=> #<Class:0x0000000143b57680>
end
I thought it would be nice for introspection and error messages if the internal subclass was assigned into a constant for named auth classes. With the changes in this pull request, we now have:
RodauthMain.internal_request_eval do
self.class #=> RodauthMain::InternalRequest
end
This is especially useful with rodauth-rails, which exposes an instance class method that returns an internal request instance:
This seems fine. I've merged it locally. I'm going to always set the constant, since there is no problem setting the constant even if the auth class is anonymous.
For named auth classes, internal request subclass is still anonymous:
I thought it would be nice for introspection and error messages if the internal subclass was assigned into a constant for named auth classes. With the changes in this pull request, we now have:
This is especially useful with rodauth-rails, which exposes an
instance
class method that returns an internal request instance:We make the constant private to ensure it stays internal.