class CanCamel::Filters::AtDay

Public Instance Methods

catch_args() click to toggle source
# File lib/can_camel/filters/at_day.rb, line 3
def catch_args
  %i(days wdays)
end
filter(days: nil, wdays: nil) click to toggle source
# File lib/can_camel/filters/at_day.rb, line 14
def filter(days: nil, wdays: nil)
  return if days && !days.include?(Time.now.day)
  return if wdays && !wdays.include?(Time.now.wday)
  {}
end
validate!() click to toggle source
# File lib/can_camel/filters/at_day.rb, line 7
def validate!
  validates presence_of: {
    fields: %i(days wdays),
    any: true,
  }
end