Module: Flip::Declarable

Included in:
Feature
Defined in:
lib/flip/declarable.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(base) ⇒ Object



4
5
6
# File 'lib/flip/declarable.rb', line 4

def self.extended(base)
  FeatureSet.reset
end

Instance Method Details

#default(default) ⇒ Object

The default response, boolean or a Proc to be called.



19
20
21
# File 'lib/flip/declarable.rb', line 19

def default(default)
  FeatureSet.instance.default = default
end

#feature(key, options = {}) ⇒ Object

Adds a new feature definition, creates predicate method.



9
10
11
# File 'lib/flip/declarable.rb', line 9

def feature(key, options = {})
  FeatureSet.instance << Flip::Definition.new(key, options)
end

#strategy(strategy) ⇒ Object

Adds a strategy for determining feature status.



14
15
16
# File 'lib/flip/declarable.rb', line 14

def strategy(strategy)
  FeatureSet.instance.add_strategy strategy
end