Class: Uses::Initializer::FromInitializers

Inherits:
BaseInitializer show all
Defined in:
lib/uses/initializer/from_initializers.rb

Instance Method Summary collapse

Methods inherited from BaseInitializer

#call, #initialize

Constructor Details

This class inherits a constructor from Uses::Initializer::BaseInitializer

Instance Method Details

#create_proc(uses_method_args) ⇒ Object



4
5
6
7
8
# File 'lib/uses/initializer/from_initializers.rb', line 4

def create_proc(uses_method_args)
  uses_method_args.uses_config.initializers.fetch(uses_method_args.klass_being_used)
rescue KeyError
  raise "An initializer for #{uses_method_args.klass_being_used.name} has not been defined. #{uses_method_args.klass_with_uses.name} has set initialize: to :config_initializers, which means it's assuming some other file (e.g. in config/initializers) has called Uses.initializers to set up the initialization"
end