Sha256: 807bf4082d17007b35b20a6599515f9bdb91387cc3870908583976d6ed9421a4

Contents?: true

Size: 874 Bytes

Versions: 3

Compression:

Stored size: 874 Bytes

Contents

module WineBouncer

  class << self
    attr_accessor :configuration
  end

  class Configuration

    attr_accessor :auth_strategy

    def auth_strategy=(strategy)
      @auth_strategy= strategy
    end

    def auth_strategy
      @auth_strategy || :default
    end

    def require_strategies
      require "wine_bouncer/auth_strategies/#{auth_strategy}"
    end
  end

   def self.configuration
    @configuration || fail(Errors::UnconfiguredError.new)
  end

  def self.configuration=(config)
    @configuration= config
    @configuration.require_strategies
  end

  ###
  # Configure block.
  # Requires all strategy specific files.
  ###
  def self.configure
    yield(config)
    config.require_strategies
    config
  end

  private

  ###
  # Returns a new configuration or existing one.
  ###
  def self.config
    @configuration ||= Configuration.new
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
wine_bouncer-0.1.2 lib/wine_bouncer/configuration.rb
wine_bouncer-0.1.1 lib/wine_bouncer/configuration.rb
wine_bouncer-0.1.0 lib/wine_bouncer/configuration.rb