Sha256: f6666754153405cc996a447497a3cce5b488f61e0261fbe807d2c083a29c7029

Contents?: true

Size: 966 Bytes

Versions: 37

Compression:

Stored size: 966 Bytes

Contents

require 'bundler/setup'
require 'flipper'
require 'flipper/adapters/operation_logger'
require 'flipper/instrumentation/log_subscriber'

Flipper.configure do |config|
  config.adapter do
    # pick an adapter, this uses memory, any will do
    Flipper::Adapters::OperationLogger.new(Flipper::Adapters::Memory.new)
  end
end

Flipper.enable(:foo)
Flipper.enable(:bar)
Flipper.disable(:baz)
Flipper.disable(:wick)
# reset the operation logging adapter to empty for clarity
Flipper.adapter.reset

# Turn on memoization (the memoizing middleware does this per request).
Flipper.memoize = true

# Preload all the features.
Flipper.preload_all

# Do as many feature checks as your heart desires.
%w[foo bar baz wick].each do |name|
  Flipper.enabled?(name)
end

# See that only one operation exists, a get_all (which is the preload_all).
pp Flipper.adapter.operations
# [#<Flipper::Adapters::OperationLogger::Operation:0x00007fdcfe1100e8
#   @args=[],
#   @type=:get_all>]

Version data entries

37 entries across 37 versions & 1 rubygems

Version Path
flipper-1.3.2 examples/memoizing.rb
flipper-1.3.1 examples/memoizing.rb
flipper-1.3.0 examples/memoizing.rb
flipper-1.3.0.pre examples/memoizing.rb
flipper-1.2.2 examples/memoizing.rb
flipper-1.2.1 examples/memoizing.rb
flipper-1.2.0 examples/memoizing.rb
flipper-1.1.2 examples/memoizing.rb
flipper-1.1.1 examples/memoizing.rb
flipper-1.1.0 examples/memoizing.rb
flipper-1.0.0 examples/memoizing.rb
flipper-1.0.0.pre examples/memoizing.rb
flipper-0.28.3 examples/memoizing.rb
flipper-0.28.2 examples/memoizing.rb
flipper-0.28.1 examples/memoizing.rb
flipper-0.28.0 examples/memoizing.rb
flipper-0.27.1 examples/memoizing.rb
flipper-0.27.0 examples/memoizing.rb
flipper-0.26.2 examples/memoizing.rb
flipper-0.26.1 examples/memoizing.rb