Method: Needle::Container#define

Defined in:
lib/needle/container.rb

#define {|builder| ... } ⇒ Object

If a block is given, yields the container’s builder instance to the block. Otherwise, simply returns the builder instance.

Usage:

container.define do |b|
  b.foo { Bar.new }
  b.baz { Baz.new }
  ...
end

Or:

container.define.foo { Bar.new }
container.define.baz { Baz.new }

Yields:



106
107
108
109
# File 'lib/needle/container.rb', line 106

def define
  yield builder if block_given?
  builder
end