Class: ActionFactory::FactoryFinder
- Inherits:
-
Object
- Object
- ActionFactory::FactoryFinder
- Defined in:
- lib/action_factory/factory_finder.rb
Constant Summary collapse
- FactoryNotFound =
Class.new(StandardError)
Class Method Summary collapse
Instance Method Summary collapse
- #factory_class ⇒ Object
-
#initialize(name) ⇒ FactoryFinder
constructor
A new instance of FactoryFinder.
Constructor Details
#initialize(name) ⇒ FactoryFinder
Returns a new instance of FactoryFinder.
15 16 17 |
# File 'lib/action_factory/factory_finder.rb', line 15 def initialize(name) @name = name end |
Class Method Details
.factory_class_for(name) ⇒ Object
10 11 12 |
# File 'lib/action_factory/factory_finder.rb', line 10 def factory_class_for(name) new(name).factory_class end |
Instance Method Details
#factory_class ⇒ Object
19 20 21 22 23 24 |
# File 'lib/action_factory/factory_finder.rb', line 19 def factory_class factory_class_name = Registry.factory_class_name_for(@name) factory_class_name.constantize rescue NameError raise FactoryNotFound, "Factory with class name #{factory_class_name.inspect} not found" end |