Class: EventSearch
- Inherits:
-
Object
- Object
- EventSearch
- Defined in:
- lib/event_search.rb
Instance Attribute Summary collapse
-
#calendars ⇒ Object
Returns the value of attribute calendars.
-
#category ⇒ Object
Returns the value of attribute category.
-
#period ⇒ Object
Returns the value of attribute period.
-
#slugs ⇒ Object
Returns the value of attribute slugs.
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize ⇒ EventSearch
constructor
A new instance of EventSearch.
Constructor Details
#initialize ⇒ EventSearch
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
#calendars ⇒ Object
Returns the value of attribute calendars.
2 3 4 |
# File 'lib/event_search.rb', line 2 def calendars @calendars end |
#category ⇒ Object
Returns the value of attribute category.
2 3 4 |
# File 'lib/event_search.rb', line 2 def category @category end |
#period ⇒ Object
Returns the value of attribute period.
2 3 4 |
# File 'lib/event_search.rb', line 2 def period @period end |
#slugs ⇒ Object
Returns the value of attribute slugs.
2 3 4 |
# File 'lib/event_search.rb', line 2 def slugs @slugs end |
Instance Method Details
#execute ⇒ Object
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 |