module Dry::Initializer::Dispatchers::UnwrapType

Public Instance Methods

call(type: nil, wrap: 0, **options) click to toggle source
# File lib/dry/initializer/dispatchers/unwrap_type.rb, line 15
def call(type: nil, wrap: 0, **options)
  type, count = unwrap(type, wrap)

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

Private Instance Methods

unwrap(type, count) click to toggle source
# File lib/dry/initializer/dispatchers/unwrap_type.rb, line 23
def unwrap(type, count)
  if type.is_a?(::Array)
    unwrap(type.first, count + 1)
  else
    [type, count]
  end
end