Sha256: 4dfc3f1862d88b82fda7cb849da2936d7c27eef4aa3f950efae7f8b018e971d9
Contents?: true
Size: 921 Bytes
Versions: 10
Compression:
Stored size: 921 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 = Typecast.from_json(contents).fetch("features") Typecast.features_hash(features) rescue JSON::ParserError raise JsonError rescue raise InvalidError end end end end end end
Version data entries
10 entries across 10 versions & 1 rubygems