Class: Objectify::Instantiator

Inherits:
Object
  • Object
show all
Defined in:
lib/objectify/instantiator.rb

Instance Method Summary collapse

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