Class: Dee::Container::SingletonFactory
- Defined in:
- lib/dee/container.rb
Instance Method Summary collapse
- #create ⇒ Object
-
#initialize(&block) ⇒ SingletonFactory
constructor
A new instance of SingletonFactory.
Constructor Details
#initialize(&block) ⇒ SingletonFactory
Returns a new instance of SingletonFactory.
14 15 16 17 |
# File 'lib/dee/container.rb', line 14 def initialize(&block) @block = block @value = nil end |
Instance Method Details
#create ⇒ Object
19 20 21 22 |
# File 'lib/dee/container.rb', line 19 def create @value = @block.call unless @value @value end |