Class: Flip::DeclarationStrategy

Inherits:
AbstractStrategy show all
Defined in:
lib/flip/declaration_strategy.rb

Instance Method Summary collapse

Methods inherited from AbstractStrategy

#delete!, #name, #switch!, #switchable?

Instance Method Details

#descriptionObject



6
7
8
# File 'lib/flip/declaration_strategy.rb', line 6

def description
  "The default status declared with the feature."
end

#knows?(definition) ⇒ Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/flip/declaration_strategy.rb', line 10

def knows? definition
  !definition.options[:default].nil?
end

#on?(definition) ⇒ Boolean

Returns:

  • (Boolean)


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

def on? definition
  default = definition.options[:default]
  default.is_a?(Proc) ? default.call(definition) : default
end