class PM::SongList
A SongList
is a list of Songs.
Attributes
name[RW]
songs[RW]
Public Class Methods
new(name)
click to toggle source
# File lib/patchmaster/song_list.rb, line 8 def initialize(name) @name = name @songs = [] end
Public Instance Methods
<<(song)
click to toggle source
# File lib/patchmaster/song_list.rb, line 13 def <<(song) @songs << song end
find(name_regex)
click to toggle source
Returns the first Song
that matches name
. name
may be either a Regexp or a String. The match will be made case-insensitive.
# File lib/patchmaster/song_list.rb, line 19 def find(name_regex) name_regex = Regexp.new(name_regex.to_s, true) # make case-insensitive @songs.detect { |s| s.name =~ name_regex } end