Class: VContainer::ContainerDsl

Inherits:
Container show all
Defined in:
lib/vcontainer/container_dsl.rb

Overview

A basic container implementation

Instance Method Summary collapse

Methods inherited from Container

#can_provide?, #provide, #provide_for_method, #use

Constructor Details

#initialize(parent = NilContainer.new) ⇒ ContainerDsl

Returns a new instance of ContainerDsl.



6
7
8
# File 'lib/vcontainer/container_dsl.rb', line 6

def initialize(parent = NilContainer.new)
  register ParentProvider.new(parent)
end

Instance Method Details

#register(*provider) ⇒ Object



10
11
12
13
14
15
16
17
18
# File 'lib/vcontainer/container_dsl.rb', line 10

def register(*provider)
  provider.each do |p|
    if p.kind_of? Class
      p = VContainer::SimpleProvider.new(p)
    end
    use(p)
  end
  self
end