Class: DB::MariaDB::Native::Types::Date

Inherits:
Object
  • Object
show all
Defined in:
lib/db/mariadb/native/types.rb

Overview

A date type converter.

Instance Method Summary collapse

Instance Method Details

#nameObject

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