17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/ioc_rb/inject.rb', line 17
def inject(dependency_name, options = {})
unless dependency_name.is_a?(Symbol)
raise ArgumentError, "dependency name should be a symbol"
end
unless options.is_a?(Hash)
raise ArgumentError, "second argument for inject method should be a Hash"
end
unless respond_to?(:_iocrb_injectable_attrs)
class_attribute :_iocrb_injectable_attrs
self._iocrb_injectable_attrs = { dependency_name => options.dup }
else
self._iocrb_injectable_attrs = self._iocrb_injectable_attrs.merge(dependency_name => options.dup)
end
attr_accessor dependency_name
end
|