Sha256: f8898c682a700a9c0dc7edc5482e85581c09b2d9ddc73590e0b128534aae1808
Contents?: true
Size: 1.07 KB
Versions: 1
Compression:
Stored size: 1.07 KB
Contents
module Flipper class Configuration def initialize @default = -> { Flipper.new(Flipper::Adapters::Memory.new) } end # Controls the default instance for flipper. When used with a block it # assigns a new default block to use to generate an instance. When used # without a block, it performs a block invocation and returns the result. # # configuration = Flipper::Configuration.new # configuration.default # => Flipper::DSL instance using Memory adapter # # # sets the default block to generate a new instance using ActiveRecord adapter # configuration.default do # require "flipper-active_record" # Flipper.new(Flipper::Adapters::ActiveRecord.new) # end # # configuration.default # => Flipper::DSL instance using ActiveRecord adapter # # Returns result of default block invocation if called without block. If # called with block, assigns the default block. def default(&block) if block_given? @default = block else @default.call end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
flipper-0.21.0.rc1 | lib/flipper/configuration.rb |