Class: Flipflop::Strategies::QueryStringStrategy

Inherits:
AbstractStrategy show all
Defined in:
lib/flipflop/strategies/query_string_strategy.rb

Instance Attribute Summary

Attributes inherited from AbstractStrategy

#description, #key, #name, #title

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from AbstractStrategy

#clear!, default_name, #hidden?, #reset!, #switch!, #switchable?

Constructor Details

#initialize(**options) ⇒ QueryStringStrategy

Returns a new instance of QueryStringStrategy.



10
11
12
13
# File 'lib/flipflop/strategies/query_string_strategy.rb', line 10

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

Class Method Details

.default_descriptionObject



5
6
7
# File 'lib/flipflop/strategies/query_string_strategy.rb', line 5

def default_description
  "Interprets query string parameters as features."
end

Instance Method Details

#enabled?(feature) ⇒ Boolean

Returns:

  • (Boolean)


15
16
17
18
19
# File 'lib/flipflop/strategies/query_string_strategy.rb', line 15

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