Sha256: 1e61ffd57d608a5f93c37fc735effb6d24090f31bd2eb9b452006718b29e3630
Contents?: true
Size: 540 Bytes
Versions: 1
Compression:
Stored size: 540 Bytes
Contents
module ShortLived # TODO Explain better what to do. # class LifetimeMissingError < StandardError; end def self.included klass klass.extend ClassMethods end def initialize window raise LifetimeMissingError.new unless self.respond_to? :lifetime super window threaded self.lifetime do self.destroy! end end module ClassMethods def lifetime lifetime = nil, &block block = lambda { lifetime } unless block_given? define_method :lifetime, &block end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
gosu_extensions-0.1.11 | lib/traits/short_lived.rb |