Sha256: 4907971998158e9b2e1b61a00f2c90d34c9e085f70df94592065b8d03a659f64

Contents?: true

Size: 703 Bytes

Versions: 10

Compression:

Stored size: 703 Bytes

Contents

require "json"
require "flipper/exporters/json/export"

module Flipper
  module Exporters
    module Json
      class V1
        VERSION = 1

        def call(adapter)
          features = adapter.get_all

          # Convert sets to arrays for json
          features.each do |feature_key, gates|
            gates.each do |key, value|
              case value
              when Set
                features[feature_key][key] = value.to_a
              end
            end
          end

          json = Typecast.to_json({
            version: VERSION,
            features: features,
          })

          Json::Export.new(contents: json, version: VERSION)
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
flipper-1.3.2 lib/flipper/exporters/json/v1.rb
flipper-1.3.1 lib/flipper/exporters/json/v1.rb
flipper-1.3.0 lib/flipper/exporters/json/v1.rb
flipper-1.3.0.pre lib/flipper/exporters/json/v1.rb
flipper-1.2.2 lib/flipper/exporters/json/v1.rb
flipper-1.2.1 lib/flipper/exporters/json/v1.rb
flipper-1.2.0 lib/flipper/exporters/json/v1.rb
flipper-1.1.2 lib/flipper/exporters/json/v1.rb
flipper-1.1.1 lib/flipper/exporters/json/v1.rb
flipper-1.1.0 lib/flipper/exporters/json/v1.rb