Method: Needle::Container#define!
- Defined in:
- lib/needle/container.rb
#define!(&block) ⇒ Object
Create a new DefinitionContext around the container, and then evaluate the block within the new context instance (via instance_eval).
Usage:
container.define! do
calc( :model => :prototype ) { Calc.new( operations ) }
end
119 120 121 122 123 |
# File 'lib/needle/container.rb', line 119 def define!( &block ) raise ArgumentError, "block expected" unless block builder.instance_eval( &block ) self end |