Class: DB::MariaDB::Native::Types::Date
- Inherits:
-
Object
- Object
- DB::MariaDB::Native::Types::Date
- Defined in:
- lib/db/mariadb/native/types.rb
Overview
A date type converter.
Instance Method Summary collapse
-
#name ⇒ Object
Get the SQL type name for date.
-
#parse(string) ⇒ Object
Parse a date value from the database.
Instance Method Details
#name ⇒ Object
Get the SQL type name for date.
155 156 157 |
# File 'lib/db/mariadb/native/types.rb', line 155 def name "DATE" end |
#parse(string) ⇒ Object
Parse a date value from the database.
162 163 164 165 166 167 168 |
# File 'lib/db/mariadb/native/types.rb', line 162 def parse(string) if string parts = string.split(/[\-\s:]/) return Time.utc(*parts) end end |