Module: Dry::Initializer::Dispatchers::PrepareTarget

Extended by:
PrepareTarget
Included in:
PrepareTarget
Defined in:
lib/dry/initializer/dispatchers/prepare_target.rb

Constant Summary collapse

RESERVED =

List of variable names reserved by the gem

%i[
  __dry_initializer_options__
  __dry_initializer_config__
  __dry_initializer_value__
  __dry_initializer_definition__
  __dry_initializer_initializer__
].freeze

Instance Method Summary collapse

Instance Method Details

#call(source:, target: nil, as: nil, **options) ⇒ Object


23
24
25
26
27
28
29
30
31
# File 'lib/dry/initializer/dispatchers/prepare_target.rb', line 23

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: source, target: target, **options}
end