Class: Gosling::ImageLibrary
- Inherits:
-
Object
- Object
- Gosling::ImageLibrary
- Includes:
- Singleton
- Defined in:
- lib/gosling/image_library.rb
Constant Summary collapse
- @@cache =
{}
Class Method Summary collapse
Class Method Details
.get(filename) ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/gosling/image_library.rb', line 9 def self.get(filename) raise ArgumentError.new("File not found: '#{filename}' in '#{Dir.pwd}'") unless File.exists?(filename) unless @@cache.has_key?(filename) @@cache[filename] = Gosu::Image.new(filename, tileable: true) end @@cache[filename] end |