Class: IoC::Dependency

Inherits:
Object show all
Defined in:
lib/ioc/dependency.rb

Instance Method Summary collapse

Constructor Details

#initialize(value, singleton: false) ⇒ Dependency

Returns a new instance of Dependency.



5
6
7
8
# File 'lib/ioc/dependency.rb', line 5

def initialize(value, singleton: false)
  @value = value
  @singleton = singleton
end

Instance Method Details

#callObject



10
11
12
# File 'lib/ioc/dependency.rb', line 10

def call
  singleton ? value : value.call
end