jeremyevans / rodauth

Ruby's Most Advanced Authentication Framework
http://rodauth.jeremyevans.net
MIT License
1.7k stars 94 forks source link

Allow not passing a block when loading the plugin #157

Closed janko closed 3 years ago

janko commented 3 years ago

When using the approach of passing Rodauth::Auth subclasses explicitly via the :auth_class option, the auth class would be configured already, so in this case it would be convenient to be able to skip passing the block when loading the plugin.

class RodauthMain < Rodauth::Auth
  configure do
    # ...
  end
end
plugin :rodauth, auth_class: RodauthMain

I was thinking whether I should move this into Rodauth::Auth.configure, or still require the block when :auth_class is not passed in, so that it's not possible to set up a Rodauth::Auth subclass without the :base feature loaded. What are your thoughts on this?

jeremyevans commented 3 years ago

I think the current implementation is fine. If someone loads the plugin without a block, it shouldn't cause any harm. I'll test and merge later today.