Class: Metro::Model::ImageProperty
- Defined in:
- lib/metro/models/properties/image_property.rb
Overview
A image property maintains a Gosu::Image.
An image is stored in the properties as a string to the specified image path and is converted into a Gosu::Image when it is retrieved within the system. When retrieving an image the Image Property will attempt to use a image at that path that already meets that criteria if it has been loaded.
Constant Summary
Constants included from Units
Instance Attribute Summary
Attributes inherited from Property
Class Method Summary collapse
-
.image_for(options) ⇒ Object
Return an image for the specified path.
Instance Method Summary collapse
-
#default_image ⇒ Object
The default image based on the default image path specified.
-
#default_image_path ⇒ Object
the default “missing.png”.
Methods inherited from Property
define_property, defined_properties, get, #get, get_or_set, gets, hash_with_default_to_nil, inherited, #initialize, properties, properties_hash, property, #set, set, sets
Constructor Details
This class inherits a constructor from Metro::Model::Property
Class Method Details
.image_for(options) ⇒ Object
Return an image for the specified path. On first request it will be loaded from the file-system. On subsequent requests it will be pulled from the cache.
89 90 91 |
# File 'lib/metro/models/properties/image_property.rb', line 89 def self.image_for() Metro::Image.find_or_create() end |
Instance Method Details
#default_image ⇒ Object
Returns the default image based on the default image path specified.
70 71 72 |
# File 'lib/metro/models/properties/image_property.rb', line 70 def default_image self.class.image_for path: default_image_path, window: model.window end |
#default_image_path ⇒ Object
the default “missing.png”
78 79 80 |
# File 'lib/metro/models/properties/image_property.rb', line 78 def default_image_path [:path] or "missing.png" end |