Class: Metro::Model::SampleProperty
- Defined in:
- lib/metro/models/properties/sample_property.rb
Overview
A sample property maintains a Gosu::Sample.
A sample is stored in the properties as the path in the assets folder and is converted into a Gosu::Sample when it is retrieved within the system. When retrieving a sample the Sample Property will attempt to use a sample that already exists that meets that criteria.
Constant Summary
Constants included from Units
Instance Attribute Summary
Attributes inherited from Property
Class Method Summary collapse
-
.sample_for(options) ⇒ Object
Returns a Metro::Sample.
Instance Method Summary collapse
-
#default_sample ⇒ Object
The default sample for the sample property.
-
#default_sample_filename ⇒ Object
A string sample name that is default.
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
Instance Method Details
#default_sample ⇒ Object
Returns the default sample for the sample property. This is based on the default sample name.
60 61 62 |
# File 'lib/metro/models/properties/sample_property.rb', line 60 def default_sample self.class.sample_for path: default_sample_filename, window: model.window end |
#default_sample_filename ⇒ Object
Returns a string sample name that is default. If the property was not created with a default value the the default sample is the missing sample found in Metro.
68 69 70 |
# File 'lib/metro/models/properties/sample_property.rb', line 68 def default_sample_filename [:path] or "missing.wav" end |