class Flipper::UI::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/ui/decorators/gate.rb, line 13
def initialize(gate, value = nil)
  super gate
  @value = value
end

Public Instance Methods

as_json() click to toggle source

Public: Returns instance as hash that is ready to be json dumped.

# 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