Module: ScheduleFu::Finder

Includes:
Parser
Included in:
Calendar, CalendarDate
Defined in:
lib/schedule_fu/finder.rb

Instance Method Summary collapse

Methods included from Parser

#parse, #parse_date, #parse_dates

Instance Method Details

#conditions_for_date_finders(*args) ⇒ Object



5
6
7
8
9
10
11
12
13
14
# File 'lib/schedule_fu/finder.rb', line 5

def conditions_for_date_finders(*args)
  dates = parse(*args)
  case dates
    when Date then ['value = ?', dates]
    when Range then ['value BETWEEN ? AND ?', dates.first, dates.last]
    when Enumerable then ['value IN (?)', dates]
    else
      raise ArgumentError
  end
end