Module: Hypo::LifetimeFriendly
Instance Method Summary collapse
- #use_lifetime(name) ⇒ Object (also: #using_lifetime)
Instance Method Details
#use_lifetime(name) ⇒ Object Also known as: using_lifetime
3 4 5 6 7 8 9 10 11 12 |
# File 'lib/hypo/lifetime_friendly.rb', line 3 def use_lifetime(name) unless @container.lifetimes.key? name raise ContainerError, "Lifetime with name \"#{name}\" is not registered" end @lifetime = @container.lifetimes[name] @lifetime.preload(self) if @lifetime.respond_to? :preload self end |