Sha256: 2b4ae72a5c3a978ad0a83a759ee9848fb584beb5d32b70ff889ceec9228e7c8b

Contents?: true

Size: 710 Bytes

Versions: 2

Compression:

Stored size: 710 Bytes

Contents

module ActiveModel
  module Validations

    module HelperMethods
      def validates_date(*attr_names)
        timeliness_validation_for attr_names, :date
      end

      def validates_time(*attr_names)
        timeliness_validation_for attr_names, :time
      end

      def validates_datetime(*attr_names)
        timeliness_validation_for attr_names, :datetime
      end

      def validates_timeliness_of(*attr_names)
        timeliness_validation_for attr_names
      end

      def timeliness_validation_for(attr_names, type=nil)
        options = _merge_attributes(attr_names)
        options.update(type: type) if type
        validates_with TimelinessValidator, options
      end
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
validates_timeliness-5.0.1 lib/validates_timeliness/helper_methods.rb
validates_timeliness-6.0.1 lib/validates_timeliness/helper_methods.rb