Class: Uses::Initializer::NewNoArgs
- Inherits:
-
BaseInitializer
- Object
- BaseInitializer
- Uses::Initializer::NewNoArgs
- Defined in:
- lib/uses/initializer/new_no_args.rb
Instance Method Summary collapse
Methods inherited from BaseInitializer
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 9 10 |
# File 'lib/uses/initializer/new_no_args.rb', line 4 def create_proc(uses_method_args) initialize_method = uses_method_args.klass_being_used.instance_method(:initialize) if !initialize_method.arity.in?([0,-1]) raise "#{uses_method_args.klass_being_used}'s initializer has required arguments, but has been used in #{uses_method_args.klass_with_uses.class} to initializer with no arguments passed to ::new. Please use initialize: with a Proc or :config_initializers to control how the instance is created" end ->() { uses_method_args.klass_being_used.new } end |