Sha256: 647e59d1b1a3551f4071dd7fefb8127303e57e6b601f9cb882847f5701102cb1
Contents?: true
Size: 543 Bytes
Versions: 1
Compression:
Stored size: 543 Bytes
Contents
# frozen_string_literal: true class ValidatesIdentity module CoCc class Validator VALIDATION_REGULAR_EXPRESSION = /\A\d{8,10}\z/i.freeze attr_reader :value def initialize(value) @value = value.to_s end def valid? return true if value.blank? return false if value.length == 9 result.present? end def formatted value end private def result @result ||= VALIDATION_REGULAR_EXPRESSION.match(value) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
validates_identity-co_cc-1.0.0 | lib/validates_identity/co_cc/validator.rb |