Class: Flipper::Toggle
- Inherits:
-
Object
- Object
- Flipper::Toggle
- 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.
Direct Known Subclasses
Flipper::Toggles::Boolean, Flipper::Toggles::Set, Flipper::Toggles::Value
Instance Attribute Summary collapse
-
#gate ⇒ Object
readonly
Returns the value of attribute gate.
Instance Method Summary collapse
-
#disable(thing) ⇒ Object
Internal: Disables thing for gate and adds feature to known features.
-
#enable(thing) ⇒ Object
Internal: Enables thing for gate and adds feature to known features.
-
#initialize(gate) ⇒ Toggle
constructor
A new instance of Toggle.
-
#inspect ⇒ Object
Public: Pretty string version for debugging.
- #value ⇒ Object
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
#gate ⇒ Object (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 |
#inspect ⇒ Object
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 |
#value ⇒ Object
31 32 33 |
# File 'lib/flipper/toggle.rb', line 31 def value raise 'Not implemented' end |