Sha256: 54df51fbae6198ae78f8b24905a5ed8617d2e73c5f20944e8e92de0973c2798d

Contents?: true

Size: 707 Bytes

Versions: 12

Compression:

Stored size: 707 Bytes

Contents

module Flipflop
  module Strategies
    class TestStrategy < AbstractStrategy
      @@lock = Mutex.new

      def initialize(**options)
        @features = {}
        super(**options)
      end

      def switchable?
        true
      end

      def enabled?(feature)
        @@lock.synchronize do
          @features[feature]
        end
      end

      def switch!(feature, enabled)
        @@lock.synchronize do
          @features[feature] = enabled
        end
      end

      def clear!(feature)
        @@lock.synchronize do
          @features.delete(feature)
        end
      end

      def reset!
        @@lock.synchronize do
          @features.clear
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
flipflop-2.8.0 lib/flipflop/strategies/test_strategy.rb
flipflop-2.7.1 lib/flipflop/strategies/test_strategy.rb
flipflop-2.7.0 lib/flipflop/strategies/test_strategy.rb
flipflop-2.6.0 lib/flipflop/strategies/test_strategy.rb
flipflop-2.5.0 lib/flipflop/strategies/test_strategy.rb
flipflop-2.4.0 lib/flipflop/strategies/test_strategy.rb
flipflop-2.3.1 lib/flipflop/strategies/test_strategy.rb
flipflop-2.3.0 lib/flipflop/strategies/test_strategy.rb
flipflop-2.2.1 lib/flipflop/strategies/test_strategy.rb
flipflop-2.2.0 lib/flipflop/strategies/test_strategy.rb
flipflop-2.1.0 lib/flipflop/strategies/test_strategy.rb
flipflop-2.0.0 lib/flipflop/strategies/test_strategy.rb