class Object
Extend object with the bean injection mechanism Example of usage: class Bar end
class Foo
inject :bar or: inject :some_bar, ref: bar
end
ioc_container.bar == ioc_container
Public Class Methods
inject(dependency_name, options = {})
click to toggle source
# 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