Module: Dry::Initializer::Dispatchers::UnwrapType

Extended by:
UnwrapType
Included in:
UnwrapType
Defined in:
lib/dry/initializer/dispatchers/unwrap_type.rb

Overview

Looks at the ‘:type` option and counts how many nested arrays it contains around either nil or a callable value.

The counted number is preserved in the ‘:wrap` virtual option used by the [WrapType] dispatcher.

Instance Method Summary collapse

Instance Method Details

#call(type: nil, wrap: 0, **options) ⇒ Object



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

def call(type: nil, wrap: 0, **options)
  type, wrap = unwrap(type, 0)

  { type: type, wrap: wrap, **options }
end