Class: ValidatesIdentity::MxRfc::LegalValidator
- Inherits:
-
Object
- Object
- ValidatesIdentity::MxRfc::LegalValidator
- Defined in:
- lib/validates_identity/mx_rfc/legal_validator.rb
Constant Summary collapse
- VALIDATION_REGULAR_EXPRESSION =
/\A([A-ZÑ&]{3})([0-9]{2}[0-1][0-9][0-3][0-9])([A-Z0-9]{3})\z/i.freeze
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #formatted ⇒ Object
-
#initialize(value) ⇒ LegalValidator
constructor
A new instance of LegalValidator.
- #valid? ⇒ Boolean
Constructor Details
#initialize(value) ⇒ LegalValidator
Returns a new instance of LegalValidator.
10 11 12 |
# File 'lib/validates_identity/mx_rfc/legal_validator.rb', line 10 def initialize(value) @value = value.to_s end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
8 9 10 |
# File 'lib/validates_identity/mx_rfc/legal_validator.rb', line 8 def value @value end |
Instance Method Details
#formatted ⇒ Object
20 21 22 |
# File 'lib/validates_identity/mx_rfc/legal_validator.rb', line 20 def formatted value end |
#valid? ⇒ Boolean
14 15 16 17 18 |
# File 'lib/validates_identity/mx_rfc/legal_validator.rb', line 14 def valid? return true if value.blank? result.present? && valid_date? end |