Update 3.7.16: as per @Jonah's suggestion, here's a description of the code's purpose:
I've built a bus-tracking application using Ruby on Rails that displays a user's location as well as the location of several nearby buses all on one map. Each bus has its own marker with an event listener that opens an info window on click.
The program is currently set up to initialize one info window, and then to update the content and position of that info window when a bus marker is clicked, such that it displays a unique descriptor based on paramaters of the bus it's attached to. It creates a marker template and then placing it many times using a loop through every element in the array of buses, displayBuses. It updates the info window by assigning the corresponding element in the array of descriptors, busInfo.
I originally coded this to create an array of markers and an array of descriptors (each containing one element for each bus) and to create a new info window for each bus attached to its marker, and containing its descriptor. That wasn't working the way I expected it to, so I modified some code I found on Stack Overflow to create the current model that initializes only one info window and updates it each time a marker is clicked. I'm particularly curious to hear folks' thoughts on this method, as it seems a little hacky to me.