Class: DBI::Type::Timestamp
Overview
Represents a SQL TIMESTAMP and returns DateTime. Falls back to Null.
Class Method Summary collapse
Class Method Details
.parse(obj) ⇒ Object
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/dbi/types.rb', line 105 def self.parse(obj) obj = super return obj unless obj case obj.class when ::DateTime return obj when ::Date return ::DateTime.parse(obj.to_s) when ::Time return ::DateTime.parse(obj.to_s) else return ::DateTime.parse(obj.to_s) if obj.respond_to? :to_s return ::DateTime.parse(obj.to_str) if obj.respond_to? :to_str return obj end end |