Sha256: b31cca7c47bc0d94502bb68cae35c1c10dc5034ba9456217318866cb53fc6355

Contents?: true

Size: 977 Bytes

Versions: 3

Compression:

Stored size: 977 Bytes

Contents

module Authlogic
  module ControllerAdapters
    # = Merb Adapter
    #
    # Adapts authlogic to work with merb. The point is to close the gap between what authlogic expects and what the merb controller object
    # provides. Similar to how ActiveRecord has an adapter for MySQL, PostgreSQL, SQLite, etc.
    class MerbAdapter < AbstractAdapter
      # = Merb Implementation
      #
      # Lets Authlogic know about the controller object, AKA "activates" authlogic.
      module MerbImplementation
        def self.included(klass) # :nodoc:
          klass.before :activate_authlogic
        end

        private
          def activate_authlogic
            Authlogic::Session::Base.controller = MerbAdapter.new(self)
          end
      end
    end
  end
end
 
# make sure we're running inside Merb
if defined?(Merb::Plugins)
  Merb::BootLoader.before_app_loads do
    Merb::Controller.send(:include, Authlogic::ControllerAdapters::MerbAdapter::MerbImplementation)
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
authlogic-1.3.5 lib/authlogic/controller_adapters/merb_adapter.rb
authlogic-1.3.6 lib/authlogic/controller_adapters/merb_adapter.rb
authlogic-1.3.7 lib/authlogic/controller_adapters/merb_adapter.rb