Sha256: c4215d01ef392bc6b819b86f1e29b9cdb7a101b92ba472d12d0d2014176c84e6

Contents?: true

Size: 874 Bytes

Versions: 4

Compression:

Stored size: 874 Bytes

Contents

module Plutonium
  module Auth
    module Rodauth
      def self.for(name)
        mod = Module.new
        mod.module_eval <<-RUBY, __FILE__, __LINE__ + 1
          extend ActiveSupport::Concern

          included do
            helper_method :current_user
            helper_method :logout_url
          end

          private

          def rodauth(name = :#{name})
            instance = super(name)
            instance.url_options = default_url_options.presence
            instance
          end

          def current_user
            rodauth.rails_account
          end

          def logout_url
            rodauth.logout_path
          end

          define_singleton_method(:to_s) { "Plutonium::Auth::Rodauth(:#{name})" }
          define_singleton_method(:inspect) { "Plutonium::Auth::Rodautht(:#{name})" }
        RUBY
        mod
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
plutonium-0.13.3 lib/plutonium/auth/rodauth.rb
plutonium-0.13.2 lib/plutonium/auth/rodauth.rb
plutonium-0.13.1 lib/plutonium/auth/rodauth.rb
plutonium-0.13.0 lib/plutonium/auth/rodauth.rb