Class: PM::SortedSongList

Inherits:
SongList show all
Defined in:
lib/patchmaster/sorted_song_list.rb

Instance Attribute Summary

Attributes inherited from SongList

#name, #songs

Instance Method Summary collapse

Methods inherited from SongList

#find, #initialize

Constructor Details

This class inherits a constructor from PM::SongList

Instance Method Details

#<<(song) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/patchmaster/sorted_song_list.rb', line 5

def <<(song)
  next_song_after = @songs.detect { |s| s.name > song.name }
  if next_song_after
    @songs.insert(@songs.index(next_song_after), song)
  else
    super(song)
  end
end