Sha256: 06e62010d2dba096f76400f9e19a5f017501bccaae21a8b7a56772527469e790
Contents?: true
Size: 1.5 KB
Versions: 1
Compression:
Stored size: 1.5 KB
Contents
module WineBouncer class << self attr_accessor :configuration end class Configuration attr_accessor :auth_strategy attr_accessor :defined_resource_owner attr_writer :auth_strategy def auth_strategy @auth_strategy || :default end def require_strategies require "wine_bouncer/auth_strategies/#{auth_strategy}" end def define_resource_owner &block fail(ArgumentError, 'define_resource_owner expects a block in the configuration') unless block_given? @defined_resource_owner = block end def defined_resource_owner fail(Errors::UnconfiguredError, 'Please define define_resource_owner to configure the resource owner') unless @defined_resource_owner @defined_resource_owner end # when the block evaluates to true, WineBouncer should be disabled # if no block is provided, WineBouncer is always enabled def disable(&block) @disable_block = block end def disable_block @disable_block || ->() { false } 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
wine_bouncer-0.5.1 | lib/wine_bouncer/configuration.rb |