Class: EventSearch

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeEventSearch

Returns a new instance of EventSearch.



4
5
6
7
8
# File 'lib/event_search.rb', line 4

def initialize
  Ical.check_refreshments
  @period = CalendarPeriod.new
  @slugs = ["all"]
end

Instance Attribute Details

#calendarsObject

Returns the value of attribute calendars.



2
3
4
# File 'lib/event_search.rb', line 2

def calendars
  @calendars
end

#categoryObject

Returns the value of attribute category.



2
3
4
# File 'lib/event_search.rb', line 2

def category
  @category
end

#periodObject

Returns the value of attribute period.



2
3
4
# File 'lib/event_search.rb', line 2

def period
  @period
end

#slugsObject

Returns the value of attribute slugs.



2
3
4
# File 'lib/event_search.rb', line 2

def slugs
  @slugs
end

Instance Method Details

#executeObject



16
17
18
19
20
# File 'lib/event_search.rb', line 16

def execute
  search = Event.between(@period.begin_date, @period.end_date)
  search = search.in_calendars(slugs) unless slugs == 'all' || slugs.nil?
  search.find(:all, :include => :calendar, :order => "start_date ASC")
end