module Dry::Types::Options
def initialize(*args, meta: EMPTY_HASH, **options)
- See: Definition#initialize -
def initialize(*args, meta: EMPTY_HASH, **options) @__args__ = args.freeze @options = options.freeze @meta = meta.freeze end
def meta(data = nil)
-
(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 = nil) if !data @meta elsif data.empty? self else with(meta: @meta.merge(data)) end end
def pristine
-
(Dry::Types::Type)
-
def pristine with(meta: EMPTY_HASH) end
def with(new_options)
-
(Type)
-
Parameters:
-
new_options
(Hash
) --
def with(new_options) self.class.new(*@__args__, **options, meta: @meta, **new_options) end