Class: Flip::AbstractStrategy

Inherits:
Object
  • Object
show all
Defined in:
lib/flip/abstract_strategy.rb

Instance Method Summary collapse

Instance Method Details

#delete!(key) ⇒ Object



23
# File 'lib/flip/abstract_strategy.rb', line 23

def delete! key; raise; end

#descriptionObject



8
# File 'lib/flip/abstract_strategy.rb', line 8

def description; ""; end

#knows?(definition) ⇒ Boolean

Whether the strategy knows the on/off state of the switch.

Returns:

  • (Boolean)


11
# File 'lib/flip/abstract_strategy.rb', line 11

def knows? definition; raise; end

#nameObject



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

def name
  self.class.name.split("::").last.gsub(/Strategy$/, "").underscore
end

#on?(definition) ⇒ Boolean

Given the state is known, whether it is on or off.

Returns:

  • (Boolean)


14
# File 'lib/flip/abstract_strategy.rb', line 14

def on? definition; raise; end

#switch!(key, on) ⇒ Object



22
# File 'lib/flip/abstract_strategy.rb', line 22

def switch! key, on; raise; end

#switchable?Boolean

Whether the feature can be switched on and off at runtime. If true, the strategy must also respond to switch! and delete!

Returns:

  • (Boolean)


18
19
20
# File 'lib/flip/abstract_strategy.rb', line 18

def switchable?
  false
end