Class: Metro::Song
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- Metro::Song
- Defined in:
- lib/metro/song.rb
Overview
Song is a wrapper class for a Gosu Song. This allows for additional data to be stored without relying on monkey-patching on functionality.
Instance Attribute Summary collapse
-
#path ⇒ Object
Returns the value of attribute path.
-
#song ⇒ Object
Returns the value of attribute song.
Class Method Summary collapse
-
.create(options) ⇒ Object
Create an Song given the window and path.
-
.find_or_create(options) ⇒ Object
Finds an existing song or creates a new song given the window and path.
Instance Method Summary collapse
-
#initialize(song, path) ⇒ Song
constructor
A new instance of Song.
Constructor Details
#initialize(song, path) ⇒ Song
Returns a new instance of Song.
11 12 13 14 15 |
# File 'lib/metro/song.rb', line 11 def initialize(song,path) super(song) @song = song @path = path end |
Instance Attribute Details
#path ⇒ Object
Returns the value of attribute path.
9 10 11 |
# File 'lib/metro/song.rb', line 9 def path @path end |
#song ⇒ Object
Returns the value of attribute song.
9 10 11 |
# File 'lib/metro/song.rb', line 9 def song @song end |
Class Method Details
.create(options) ⇒ Object
Create an Song given the window and path.
36 37 38 39 40 |
# File 'lib/metro/song.rb', line 36 def self.create() window, asset_path = create_params() gosu_song = Gosu::Song.new(window,asset_path.filepath) new gosu_song, asset_path.path end |