Sha256: 075fad4d475fcfb8ce9ec75d8740c56b9e0c3fbef856d1597115c5ffa92f1f26
Contents?: true
Size: 896 Bytes
Versions: 2
Compression:
Stored size: 896 Bytes
Contents
require 'json' module Determinator module Serializers module JSON class << self def dump(feature) raise NotImplementedError end def load(string_or_hash) obj = string_or_hash.is_a?(Hash) ? string_or_hash : ::JSON.parse(string_or_hash) Determinator::Feature.new( name: obj['name'], identifier: obj['identifier'], bucket_type: obj['bucket_type'], active: (obj['active'] === true), target_groups: obj['target_groups'], fixed_determinations: obj['fixed_determinations'].to_a, variants: obj['variants'].to_h, overrides: obj['overrides'].to_h, winning_variant: obj['winning_variant'].to_s, ) end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
determinator-2.5.1 | lib/determinator/serializers/json.rb |
determinator-2.5.0 | lib/determinator/serializers/json.rb |