class Babik::Selection::Operation::WeekDay
WeekDay
(1-7, sunday to monday) date operation
Public Class Methods
new(field, operator, value)
click to toggle source
Calls superclass method
Babik::Selection::Operation::DateOperation::new
# File lib/babik/queryset/lib/selection/operation/date.rb, line 102 def initialize(field, operator, value) value = format('%d', value) if db_engine == 'sqlite3' super(field, operator, value) end
Public Instance Methods
sql_function()
click to toggle source
# File lib/babik/queryset/lib/selection/operation/date.rb, line 107 def sql_function dbms_adapter = db_engine return 'DAYOFWEEK(#field) - 1' if dbms_adapter == 'mysql2' return 'EXTRACT(DOW FROM #field)' if dbms_adapter == 'postgresql' return 'strftime(\'%w\', #field)' if dbms_adapter == 'sqlite3' raise NotImplementedError, "#{self.class} lookup not implemented for #{dbms_adapter}" end