Sha256: de1aa82b581a937af552671b4968e8fbbdc2ada6fa80818479c7019fc949e115

Contents?: true

Size: 833 Bytes

Versions: 6

Compression:

Stored size: 833 Bytes

Contents

require 'active_support/configurable'

module TypeStation
  # Configures global settings for TypeStation
  #   TypeStation.configure do |config|
  #     config.model = User
  #   end
  def self.configure(&block)
    yield @config ||= TypeStation::Configuration.new
  end

  # Global settings for TypeStation
  def self.config
    @config
  end

  class Configuration
    include ActiveSupport::Configurable

    config_accessor :authenticate_with
    config_accessor :authorise_with
    config_accessor :current_user
    
  end

  configure do |config|
    config.authenticate_with = Proc.new do
      request.env['warden'].try(:authenticate!)
    end
    config.authorise_with = Proc.new {}
    config.current_user = Proc.new do
      request.env["warden"].try(:user) || respond_to?(:current_user) && current_user
    end 
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
type_station-0.1.3 lib/type_station/configuration.rb
type_station-0.1.1 lib/type_station/configuration.rb
type_station-0.0.3 lib/type_station/configuration.rb
type_station-0.0.2 lib/type_station/configuration.rb
type_station-0.0.1 lib/type_station/configuration.rb
type_station-0.0.1.pre lib/type_station/configuration.rb