Permalink
Browse files

No need to string.to_s right after checking that string.is_a?(String)

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2418 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent e828657 commit 3f1aad8ac958419c11703140e697a4dfc245b161 @jeremy jeremy committed Sep 30, 2005
@@ -71,21 +71,21 @@ def binary_to_string(value)
private
def string_to_date(string)
return string unless string.is_a?(String)
- date_array = ParseDate.parsedate(string.to_s)
+ date_array = ParseDate.parsedate(string)
# treat 0000-00-00 as nil
Date.new(date_array[0], date_array[1], date_array[2]) rescue nil
end
def string_to_time(string)
return string unless string.is_a?(String)
- time_array = ParseDate.parsedate(string.to_s).compact
+ time_array = ParseDate.parsedate(string).compact
# treat 0000-00-00 00:00:00 as nil
Time.send(Base.default_timezone, *time_array) rescue nil
end
def string_to_dummy_time(string)
return string unless string.is_a?(String)
- time_array = ParseDate.parsedate(string.to_s)
+ time_array = ParseDate.parsedate(string)
# pad the resulting array with dummy date information
time_array[0] = 2000; time_array[1] = 1; time_array[2] = 1;
Time.send(Base.default_timezone, *time_array) rescue nil

0 comments on commit 3f1aad8

Please sign in to comment.