Class: EventSearch

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

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (EventSearch) initialize



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

- (Object) calendars

Returns the value of attribute calendars



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

def calendars
  @calendars
end

- (Object) category

Returns the value of attribute category



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

def category
  @category
end

- (Object) period

Returns the value of attribute period



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

def period
  @period
end

- (Object) slugs

Returns the value of attribute slugs



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

def slugs
  @slugs
end

Instance Method Details

- (Object) execute



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