class Flipper::Api::V1::Decorators::Gate

Attributes

value[R]

Public: the value for the gate from the adapter.

Public Class Methods

new(gate, value = nil) click to toggle source
Calls superclass method
# File lib/flipper/api/v1/decorators/gate.rb, line 12
def initialize(gate, value = nil)
  super gate
  @value = value
end

Public Instance Methods

as_json() click to toggle source
# 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

Private Instance Methods

value_as_json() click to toggle source

json doesn't like sets

# File lib/flipper/api/v1/decorators/gate.rb, line 28
def value_as_json
  data_type == :set ? value.to_a : value
end