Sha256: 89793ba51d1382a64212fd32773b2dfbbb05941466b42bd6d3dca6818d2c1e63
Contents?: true
Size: 310 Bytes
Versions: 6
Compression:
Stored size: 310 Bytes
Contents
class IpValidator < ActiveModel::EachValidator def validate_each(object, attribute, value) unless value =~ /^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/ object.errors[attribute] << (options[:message] || "is not formatted properly") end end end
Version data entries
6 entries across 6 versions & 1 rubygems