Module: Dry::Initializer::Dispatchers::PrepareOptional

Defined in:
lib/dry/initializer/dispatchers/prepare_optional.rb

Class Method Summary collapse

Class Method Details

.call(optional: nil, default: nil, required: nil, **options) ⇒ Object


11
12
13
14
15
16
# File 'lib/dry/initializer/dispatchers/prepare_optional.rb', line 11

def call(optional: nil, default: nil, required: nil, **options)
  optional ||= default
  optional &&= !required

  {optional: !!optional, default: default, **options}
end