class Flipper::Api::V1::Decorators::Feature

Public Instance Methods

as_json() click to toggle source

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

# File lib/flipper/api/v1/decorators/feature.rb, line 13
def as_json
  gate_values = feature.adapter.get(self)
  gates_json = gates.map do |gate|
    Decorators::Gate.new(gate, gate_values[gate.key]).as_json
  end

  {
    'key' => key,
    'state' => state.to_s,
    'gates' => gates_json,
  }
end