module Dry::Types::Meta
def initialize(*args, meta: EMPTY_HASH, **options)
def initialize(*args, meta: EMPTY_HASH, **options) super(*args, **options) @meta = meta.freeze end
def meta(data = Undefined)
- Api: - public
Returns:
-
(Type)
- new type with added metadata -
(Hash)
- metadata associated with type
Parameters:
-
new
(Hash
) -- metadata to merge into existing metadata
Overloads:
-
meta(data)
-
meta
def meta(data = Undefined) if Undefined.equal?(data) @meta elsif data.empty? self else with(meta: @meta.merge(data)) end end
def pristine = with(meta: EMPTY_HASH)
- Api: - public
Returns:
-
(Dry::Types::Type)
-
def pristine = with(meta: EMPTY_HASH)
def with(**options) = super(meta: @meta, **options)
- Api: - public
Returns:
-
(Type)
-
Parameters:
-
options
(Hash
) -- new_options
def with(**options) = super(meta: @meta, **options)