Class: Flipper::Toggle

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/flipper/toggle.rb

Overview

Internal: Used by gate to toggle values (true/false, add/delete from set, etc.). Named poorly maybe, but haven’t come up with a better name yet.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(gate) ⇒ Toggle

Returns a new instance of Toggle.



13
14
15
# File 'lib/flipper/toggle.rb', line 13

def initialize(gate)
  @gate = gate
end

Instance Attribute Details

#gateObject (readonly)

Returns the value of attribute gate.



9
10
11
# File 'lib/flipper/toggle.rb', line 9

def gate
  @gate
end

Instance Method Details

#disable(thing) ⇒ Object

Internal: Disables thing for gate and adds feature to known features.

Returns Boolean (currently always true).



27
28
29
# File 'lib/flipper/toggle.rb', line 27

def disable(thing)
  add_feature_to_set
end

#enable(thing) ⇒ Object

Internal: Enables thing for gate and adds feature to known features.

Returns Boolean (currently always true).



20
21
22
# File 'lib/flipper/toggle.rb', line 20

def enable(thing)
  add_feature_to_set
end

#inspectObject

Public: Pretty string version for debugging.



36
37
38
39
40
41
42
# File 'lib/flipper/toggle.rb', line 36

def inspect
  attributes = [
    "gate=#{gate.inspect}",
    "value=#{value}",
  ]
  "#<#{self.class.name}:#{object_id} #{attributes.join(', ')}>"
end

#valueObject



31
32
33
# File 'lib/flipper/toggle.rb', line 31

def value
  raise 'Not implemented'
end