module Dry::Initializer::Dispatchers::PrepareTarget

def call(source:, target: nil, as: nil, **options)

def call(source:, target: nil, as: nil, **options)
  target ||= as || source
  target = target.to_s.to_sym.downcase
  check_ruby_name!(target)
  check_reserved_names!(target)
  {source:, target:, **options}
end

def check_reserved_names!(target)

def check_reserved_names!(target)
  return unless RESERVED.include?(target)
  raise ArgumentError,
        "The method name `#{target}` is reserved by the dry-initializer gem"
end

def check_ruby_name!(target)

def check_ruby_name!(target)
  return if target[/\A[[:alpha:]_][[:alnum:]_]*\??\z/u]
  raise ArgumentError,
        "The name `#{target}` is not allowed for Ruby methods"
end