lib/flipper/api/v1/decorators/feature.rb in flipper-api-0.10.2 vs lib/flipper/api/v1/decorators/feature.rb in flipper-api-0.11.0.beta1
- old
+ new
@@ -4,22 +4,21 @@
module Flipper
module Api
module V1
module Decorators
class Feature < SimpleDelegator
-
# Public: The feature being decorated.
alias_method :feature, :__getobj__
# Public: Returns instance as hash that is ready to be json dumped.
def as_json
- gate_values = feature.gate_values
+ gate_values = feature.adapter.get(self)
{
'key' => key,
'state' => state.to_s,
- 'gates' => gates.map { |gate|
+ 'gates' => gates.map do |gate|
Decorators::Gate.new(gate, gate_values[gate.key]).as_json
- },
+ end,
}
end
end
end
end