Class: Flipper::Api::V1::Decorators::Gate
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- Flipper::Api::V1::Decorators::Gate
- Defined in:
- lib/flipper/api/v1/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(exclude_name: false) ⇒ Object
-
#initialize(gate, value = nil) ⇒ Gate
constructor
A new instance of Gate.
Constructor Details
#initialize(gate, value = nil) ⇒ Gate
Returns a new instance of Gate.
12 13 14 15 |
# File 'lib/flipper/api/v1/decorators/gate.rb', line 12 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.
10 11 12 |
# File 'lib/flipper/api/v1/decorators/gate.rb', line 10 def value @value end |
Instance Method Details
#as_json(exclude_name: false) ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/flipper/api/v1/decorators/gate.rb', line 17 def as_json(exclude_name: false) as_json = { 'key' => gate.key.to_s, 'value' => value_as_json, } as_json['name'] = gate.name.to_s unless exclude_name as_json end |