Spears … Baby One More Time Britney Spears In The Zone Britney Spears Circus { "Green Day" => [ "Dookie", "American Idiot" ], "Britney Spears" => [ "... Baby One More Time", "In The Zone", "Circus" ], }
Spears" => [ "... Baby One More Time", "In The Zone", "Circus" ], } [ ["Green Day", "Dookie"], ["Green Day", "American Idiot"], ["Britney Spears", "... Baby One More Time"], ["Britney Spears", "In The Zone"], ["Britney Spears", "Circus"], ]
i in (0..albums_list.length - 1) do 5 artist, album = albums_list[i] 6 7 cur_albums = albums_map[artist] 8 if cur_albums 9 cur_albums << album 10 albums_map[artist] = cur_albums 11 else 12 albums_map[artist] = [album] 13 end 14 end 15 16 albums_map 17 end
self.insert(key, value) @store[key] = value end def self.drop @store = {} end end Database.insert("Green Day", ["Dookie"]) Database.get("Green Day") # ["Dookie"]