Class: Rulix::Validators::DateValidator
- Inherits:
-
Object
- Object
- Rulix::Validators::DateValidator
- Defined in:
- lib/rulix/validators/date_validator.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.to_proc ⇒ Object
6 7 8 |
# File 'lib/rulix/validators/date_validator.rb', line 6 def self.to_proc new.method(:call) end |
Instance Method Details
#call(date) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/rulix/validators/date_validator.rb', line 10 def call date if date begin Date.parse date true rescue ArgumentError [false, "is not a date"] end else [false, 'is not a date'] end end |
#error_message(value = nil) ⇒ Object
24 25 26 |
# File 'lib/rulix/validators/date_validator.rb', line 24 def value = nil "is not a date" end |