module Determinator::Serializers::JSON
Public Class Methods
dump(feature)
click to toggle source
# File lib/determinator/serializers/json.rb, line 7 def dump(feature) raise NotImplementedError end
load(string_or_hash)
click to toggle source
# File lib/determinator/serializers/json.rb, line 11 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'], structured_bucket: obj['structured_bucket'], 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