Sha256: bf844e8b64d27084ce3bafe7bdb7d574549227ccea675f6fdf1f021f40f2094e

Contents?: true

Size: 383 Bytes

Versions: 8

Compression:

Stored size: 383 Bytes

Contents

module ShortLived
  
  def self.included klass
    klass.extend ClassMethods
  end
  
  def initialize window
    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

8 entries across 8 versions & 1 rubygems

Version Path
gosu_extensions-0.1.8 lib/traits/short_lived.rb
gosu_extensions-0.1.7 lib/traits/short_lived.rb
gosu_extensions-0.1.6 lib/traits/short_lived.rb
gosu_extensions-0.1.5 lib/traits/short_lived.rb
gosu_extensions-0.1.4 lib/traits/short_lived.rb
gosu_extensions-0.1.3 lib/traits/short_lived.rb
gosu_extensions-0.1.2 lib/traits/short_lived.rb
gosu_extensions-0.1.1 lib/traits/short_lived.rb