Class: Flipper::Api::V1::Decorators::Gate

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/flipper/api/v1/decorators/gate.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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 ⇒ Object



17
18
19
20
21
22
23
# File 'lib/flipper/api/v1/decorators/gate.rb', line 17

def as_json
  {
    'key' => gate.key.to_s,
    'name' => gate.name.to_s,
    'value' => value_as_json,
  }
end