Class: ValidatesIdentity::CoCc::Validator
- Inherits:
-
Object
- Object
- ValidatesIdentity::CoCc::Validator
- Defined in:
- lib/validates_identity/co_cc/validator.rb
Constant Summary collapse
- VALIDATION_REGULAR_EXPRESSION =
/\A\d{8,10}\z/i.freeze
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #formatted ⇒ Object
-
#initialize(value) ⇒ Validator
constructor
A new instance of Validator.
- #valid? ⇒ Boolean
Constructor Details
#initialize(value) ⇒ Validator
Returns a new instance of Validator.
10 11 12 |
# File 'lib/validates_identity/co_cc/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/co_cc/validator.rb', line 8 def value @value end |
Instance Method Details
#formatted ⇒ Object
21 22 23 |
# File 'lib/validates_identity/co_cc/validator.rb', line 21 def formatted value end |
#valid? ⇒ Boolean
14 15 16 17 18 19 |
# File 'lib/validates_identity/co_cc/validator.rb', line 14 def valid? return true if value.blank? return false if value.length == 9 result.present? end |