Class: Flipper::Api::V1::Decorators::Gate
- Inherits:
-
Object
- Object
- Flipper::Api::V1::Decorators::Gate
- Defined in:
- lib/flipper/api/v1/decorators/gate.rb
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.
6 7 8 9 |
# File 'lib/flipper/api/v1/decorators/gate.rb', line 6 def initialize(gate, value = nil) @gate = gate @value = value end |
Instance Method Details
#as_json(exclude_name: false) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/flipper/api/v1/decorators/gate.rb', line 11 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 |