Sha256: fae61b598418e259349bad196b69921af5083b85a455426a8a67c721e8d43f38

Contents?: true

Size: 584 Bytes

Versions: 1

Compression:

Stored size: 584 Bytes

Contents

require 'active_model'

module Rekiq
  class ScheduleFormatValidator < ActiveModel::EachValidator
    def validate_each(record, attribute, value)
      unless value.respond_to?(:next_occurrence) and
             value.method(:next_occurrence).arity.abs > 0
        record.errors[attribute] <<
          "invalid value for #{attribute}, value must be an object that " \
          'responds to next_occurrence, and that receives at least one ' \
          'argument of type Time, representing Time from which to calculate ' \
          'next occurrence time'
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rekiq-0.0.1 lib/rekiq/schedule_format_validator.rb