Sha256: 5ca3b857eaa44abe1befaf2140907e8332b09b5ee0eec28139a2f5616adf24d7
Contents?: true
Size: 453 Bytes
Versions: 16
Compression:
Stored size: 453 Bytes
Contents
# frozen_string_literal: true module ValidateParams class Types class DateTime def self.valid?(value) Time.at(Integer(value)) true rescue ArgumentError, TypeError false end def self.cast(raw_value, **) return raw_value if raw_value.is_a?(::Time) Time.at(Integer(raw_value)) rescue ArgumentError, TypeError raw_value end end end end
Version data entries
16 entries across 16 versions & 1 rubygems