class DBI::DBD::Mysql::Type::Date

Custom handling for DATE types in MySQL. See DBI::Type for more information.

Public Class Methods

parse(obj) click to toggle source
Calls superclass method
# File lib/dbd/Mysql.rb, line 117
def self.parse(obj)
    obj = super
    return obj unless obj

    case obj.class
    when ::Date
        return obj
    when ::String
        return ::Date.strptime(obj, "%Y-%m-%d")
    else
        return ::Date.parse(obj.to_s)   if obj.respond_to? :to_s
        return ::Date.parse(obj.to_str) if obj.respond_to? :to_str
        return obj
    end
end