Sha256: 692e67d9eba1b9f2fd51ace130f2fcac880c3382c37c209683a9578fdc14a07c

Contents?: true

Size: 633 Bytes

Versions: 9

Compression:

Stored size: 633 Bytes

Contents

module Flipflop
  module Strategies
    class QueryStringStrategy < AbstractStrategy
      class << self
        def default_description
          "Interprets query string parameters as features."
        end
      end

      def initialize(**options)
        @prefix = options.delete(:prefix).to_s.freeze
        super(**options)
      end

      def enabled?(feature)
        return unless request?
        return unless request.params.has_key?(param_key(feature))
        request.params[param_key(feature)] != "0"
      end

      protected

      def param_key(feature)
        @prefix + feature.to_s
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
flipflop-2.8.0 lib/flipflop/strategies/query_string_strategy.rb
flipflop-2.7.1 lib/flipflop/strategies/query_string_strategy.rb
flipflop-2.7.0 lib/flipflop/strategies/query_string_strategy.rb
flipflop-2.6.0 lib/flipflop/strategies/query_string_strategy.rb
flipflop-2.5.0 lib/flipflop/strategies/query_string_strategy.rb
flipflop-2.4.0 lib/flipflop/strategies/query_string_strategy.rb
flipflop-2.3.1 lib/flipflop/strategies/query_string_strategy.rb
flipflop-2.3.0 lib/flipflop/strategies/query_string_strategy.rb
flipflop-2.2.1 lib/flipflop/strategies/query_string_strategy.rb