require 'set' require './lib/util' @songs = nil def get_song_ids dir ids = Set.new Dir.new(src SongsDir).children.each do |filename| ids.add(File.basename filename, '.*') end ids end def songs @songs ||= get_song_ids(SongsDir).map do |song_id| [song_id, Song.from_yaml(song_id)] end.to_h end