Sha256: a128c027c766e17925e492c739449b25c73a1f261fff69d562af6806f42284af
Contents?: true
Size: 588 Bytes
Versions: 35
Compression:
Stored size: 588 Bytes
Contents
# Singleton scope returns same bean instance on each call class SmartIoC::Scopes::Singleton VALUE = :singleton def initialize @beans = {} end # @param klass [Class] bean class # @returns bean instance or nil if not stored def get_bean(klass) @beans[klass] end # @param klass [Class] bean class # @param bean [Any Object] bean object # @returns nil def save_bean(klass, bean) @beans[klass] = bean nil end def clear # do nothing as singleton beans are being instantiated only once end def force_clear @beans = {} nil end end
Version data entries
35 entries across 35 versions & 1 rubygems