Sha256: 4023627c3ade245cce356bfe2c4d511ac217a5531770d7c8c7ff40d85a8ee08e

Contents?: true

Size: 696 Bytes

Versions: 8

Compression:

Stored size: 696 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 = JSON.dump({
            version: VERSION,
            features: features,
          })

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

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
flipper-1.0.0 lib/flipper/exporters/json/v1.rb
flipper-1.0.0.pre lib/flipper/exporters/json/v1.rb
flipper-0.28.3 lib/flipper/exporters/json/v1.rb
flipper-0.28.2 lib/flipper/exporters/json/v1.rb
flipper-0.28.1 lib/flipper/exporters/json/v1.rb
flipper-0.28.0 lib/flipper/exporters/json/v1.rb
flipper-0.27.1 lib/flipper/exporters/json/v1.rb
flipper-0.27.0 lib/flipper/exporters/json/v1.rb