Sha256: c8e8b6387b23251168f5b51eb62cdfe046d1ffd256f05df243e699ab26628503

Contents?: true

Size: 1.38 KB

Versions: 1

Compression:

Stored size: 1.38 KB

Contents

require 'active_support/core_ext/class'
require 'janus/config'
require 'janus/hooks'
require 'janus/strategies'
require 'janus/manager'
require 'janus/rails' if defined?(Rails)

autoload :JanusHelper, 'janus/helper'

module Janus
  class NotAuthenticated < StandardError
    cattr_accessor :scope

    def initialize(scope)
      super("")
      self.scope = scope
    end
  end

  module Models
    autoload :Base,                    'janus/models/base'
    autoload :DatabaseAuthenticatable, 'janus/models/database_authenticatable'
    autoload :Confirmable,             'janus/models/confirmable'
    autoload :Rememberable,            'janus/models/rememberable'
    autoload :RemoteAuthenticatable,   'janus/models/remote_authenticatable'
    autoload :RemoteToken,             'janus/models/remote_token'
    autoload :Trackable,               'janus/models/trackable'
  end

  module Strategies
    autoload :Base,                    'janus/strategies/base'
    autoload :Rememberable,            'janus/strategies/rememberable'
    autoload :RemoteAuthenticatable,   'janus/strategies/remote_authenticatable'
  end

  def self.scope_for(user_or_scope)
    case user_or_scope
    when Symbol then user_or_scope
    when String then user_or_scope.to_sym
    else user_or_scope.class.name.underscore.to_sym
    end
  end

  def self.config
    yield(Janus::Config) if block_given?
    Janus::Config
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
janus-0.7.0 lib/janus.rb