Class: Hypo::Singleton
- Inherits:
-
Object
- Object
- Hypo::Singleton
- Defined in:
- lib/hypo/life_style/singleton.rb
Instance Method Summary collapse
-
#initialize(component) ⇒ Singleton
constructor
A new instance of Singleton.
- #instance ⇒ Object
Constructor Details
#initialize(component) ⇒ Singleton
Returns a new instance of Singleton.
3 4 5 |
# File 'lib/hypo/life_style/singleton.rb', line 3 def initialize(component) @component = component end |
Instance Method Details
#instance ⇒ Object
7 8 9 10 |
# File 'lib/hypo/life_style/singleton.rb', line 7 def instance @instance = @component.type.new(*@component.dependencies) if @instance.nil? @instance end |