Class: Flipper::UI::Decorators::Gate
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- Flipper::UI::Decorators::Gate
- Defined in:
- lib/flipper/ui/decorators/gate.rb
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
Public: The value for the gate from the adapter.
Instance Method Summary collapse
-
#as_json ⇒ Object
Public: Returns instance as hash that is ready to be json dumped.
-
#initialize(gate, value = nil) ⇒ Gate
constructor
A new instance of Gate.
Constructor Details
#initialize(gate, value = nil) ⇒ Gate
Returns a new instance of Gate.
13 14 15 16 |
# File 'lib/flipper/ui/decorators/gate.rb', line 13 def initialize(gate, value = nil) super gate @value = value end |
Instance Attribute Details
#value ⇒ Object (readonly)
Public: The value for the gate from the adapter.
11 12 13 |
# File 'lib/flipper/ui/decorators/gate.rb', line 11 def value @value end |
Instance Method Details
#as_json ⇒ Object
Public: Returns instance as hash that is ready to be json dumped.
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/flipper/ui/decorators/gate.rb', line 19 def as_json value_as_json = case data_type when :set value.to_a # json doesn't like sets else value end { 'key' => gate.key.to_s, 'name' => gate.name.to_s, 'value' => value_as_json, } end |