Class: Zvents::SearchResults

Inherits:
Object
  • Object
show all
Defined in:
lib/zvents/search_results.rb

Instance Method Summary collapse

Instance Method Details

#eventsObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/zvents/search_results.rb', line 10

def events
   unless @venues_initialized
        venue_hash = {} # A hash allows for this method to be run in linear time
                        # at the cost of space
        @venues.each do |venue|
            venue_hash[venue.id] = venue
        end
        @events.each do |event|
            event.venue = venue_hash[event.venue_id]
        end
    end
    @venues_initialized = true
    @events
end