Sha256: 4bdbdc91367ab37168acdbf1e7ca8212366f1a2a3a366fe4964b2988c4cd66d8
Contents?: true
Size: 505 Bytes
Versions: 21
Compression:
Stored size: 505 Bytes
Contents
# frozen_string_literal: true module Eventsimple class Message < Dry::Struct transform_keys(&:to_sym) # dry types will apply default values only on missing keys # modify the behaviour so the default is used even when the key is present but nil transform_types do |type| if type.default? type.constructor do |value| value.nil? ? Dry::Types::Undefined : value end else type end end def inspect as_json end end end
Version data entries
21 entries across 21 versions & 1 rubygems