Sha256: 6cf3f4123d3e925fccd100de36bcb23206438f81c8b5d112d271462b9e5a19ef
Contents?: true
Size: 996 Bytes
Versions: 9
Compression:
Stored size: 996 Bytes
Contents
# frozen_string_literal: true module Yoti module DynamicSharingService # A wanted anchor for a source based constraint class WantedAnchor attr_reader :value attr_reader :sub_type def initialize @value = '' @sub_type = nil end def to_json(*_args) as_json.to_json end def as_json obj = { name: @value } obj[:sub_type] = @sub_type if @sub_type obj end def self.builder WantedAnchorBuilder.new end end # Builder for WantedAnchor class WantedAnchorBuilder def initialize @anchor = WantedAnchor.new end def with_value(value) @anchor.instance_variable_set(:@value, value) self end def with_sub_type(sub_type = nil) @anchor.instance_variable_set(:@sub_type, sub_type) self end def build Marshal.load Marshal.dump @anchor end end end end
Version data entries
9 entries across 9 versions & 1 rubygems