Sha256: 6f6a075184977b6069e4ed797ab7f08dc3fa0f88a44f40473ea19bdb996f2618
Contents?: true
Size: 913 Bytes
Versions: 8
Compression:
Stored size: 913 Bytes
Contents
require "flipper/export" require "flipper/typecast" module Flipper module Exporters module Json # Raised when the contents of the export are not valid. class InvalidError < StandardError; end class JsonError < InvalidError; end # Internal: JSON export class that knows how to build features hash # from data. class Export < ::Flipper::Export def initialize(contents:, version: 1) super contents: contents, version: version, format: :json end # Public: The features hash identical to calling get_all on adapter. def features @features ||= begin features = JSON.parse(contents).fetch("features") Typecast.features_hash(features) rescue JSON::ParserError raise JsonError rescue raise InvalidError end end end end end end
Version data entries
8 entries across 8 versions & 1 rubygems