Class: Objectify::Instantiator
- Inherits:
-
Object
- Object
- Objectify::Instantiator
- Defined in:
- lib/objectify/instantiator.rb
Instance Method Summary collapse
- #call(name, type) ⇒ Object
-
#initialize(injector) ⇒ Instantiator
constructor
A new instance of Instantiator.
Constructor Details
#initialize(injector) ⇒ Instantiator
Returns a new instance of Instantiator.
5 6 7 |
# File 'lib/objectify/instantiator.rb', line 5 def initialize(injector) @injector = injector end |
Instance Method Details
#call(name, type) ⇒ Object
9 10 11 12 13 |
# File 'lib/objectify/instantiator.rb', line 9 def call(name, type) join_char = type == :policy ? "_" : "/" klass = [name, type].join(join_char).classify.constantize @injector.call(klass, :new) end |