# File lib/dbi/types.rb, line 165 def self.parse(obj) case obj when ::DateTime return obj when ::Date return create(obj.year, obj.month, obj.day, 0, 0, 0) when ::Time return create(obj.year, obj.month, obj.day, obj.hour, obj.min, obj.sec, Rational(obj.usec, 86400000000), Rational(obj.utc_offset, 86400)) else obj = super return obj unless obj return create(*parse_string(obj.to_s)) if obj.respond_to? :to_s return create(*parse_string(obj.to_str)) if obj.respond_to? :to_str return obj end end