Sha256: 160a76be0155e316b4c270c7522f243ea04b20397a88287f1d47fdabee5586a9
Contents?: true
Size: 434 Bytes
Versions: 35
Compression:
Stored size: 434 Bytes
Contents
# frozen_string_literal: true class MiniDefender::Rules::ExpiryMonth < MiniDefender::Rule def self.signature 'expiry_month' end def coerce(value) value.to_s.rjust(2, '0') end def passes?(attribute, value, validator) return false unless value.to_s.match?(/^\d{1,2}$/) value = value.to_i value >= 1 && value <= 12 end def message(attribute, value, validator) 'Invalid expiry month.' end end
Version data entries
35 entries across 35 versions & 1 rubygems