Class: Magiq::Types::Date
Constant Summary collapse
- DATE_RNG =
/[12]{1}[0-9]{3}\-[10]{1}[0-9]{1}\-[0123]{1}[0-9]{1}/
Instance Attribute Summary
Attributes inherited from Type
Instance Method Summary collapse
Methods inherited from Type
Constructor Details
This class inherits a constructor from Magiq::Types::Type
Instance Method Details
#cast! ⇒ Object
205 206 207 208 209 210 211 212 |
# File 'lib/magiq/types.rb', line 205 def cast! if raw =~ DATE_RNG Date.parse($1) else bad! "provided value of #{raw.inspect} is not permitted, it must " \ "be an ISO 8601 formatted date: YYYY-MM-DD" end end |