Class: Animoto::Assets::Song
Instance Attribute Summary collapse
-
#artist ⇒ String
The artist of this song.
-
#duration ⇒ Float
The duration in seconds of how long this song should play.
-
#start_time ⇒ Float
The offset in seconds from the beginning denoting where to start using this song in the video.
-
#title ⇒ String
The title of this song.
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(source, options = {}) ⇒ Assets::Song
constructor
Creates a new Song object.
-
#to_hash ⇒ Hash{String=>Object}
Returns a representation of this Song as a Hash.
Constructor Details
#initialize(source, options = {}) ⇒ Assets::Song
Creates a new Song object.
33 34 35 36 37 38 39 |
# File 'lib/animoto/assets/song.rb', line 33 def initialize source, = {} super @start_time = [:start_time] @duration = [:duration] @title = [:title] @artist = [:artist] end |
Instance Attribute Details
#artist ⇒ String
The artist of this song. Default to the title read from the metadata of the source file.
22 23 24 |
# File 'lib/animoto/assets/song.rb', line 22 def artist @artist end |
#duration ⇒ Float
The duration in seconds of how long this song should play.
12 13 14 |
# File 'lib/animoto/assets/song.rb', line 12 def duration @duration end |
#start_time ⇒ Float
The offset in seconds from the beginning denoting where to start using this song in the video.
8 9 10 |
# File 'lib/animoto/assets/song.rb', line 8 def start_time @start_time end |
#title ⇒ String
The title of this song. Defaults to the title read from the metadata of the source file.
17 18 19 |
# File 'lib/animoto/assets/song.rb', line 17 def title @title end |
Instance Method Details
#to_hash ⇒ Hash{String=>Object}
Returns a representation of this Song as a Hash.
45 46 47 48 49 50 51 52 |
# File 'lib/animoto/assets/song.rb', line 45 def to_hash hash = super hash['start_time'] = start_time if start_time hash['duration'] = duration if duration hash['title'] = title if title hash['artist'] = artist if artist hash end |