diff options
author | Kent Sibilev <ksibilev@gmail.com> | 2006-09-05 04:37:43 +0000 |
---|---|---|
committer | Kent Sibilev <ksibilev@gmail.com> | 2006-09-05 04:37:43 +0000 |
commit | 7cdd0d6ecf6afe0af98faf52e40b40deb5a15384 (patch) | |
tree | 4d78319216b7c12a6ed09a589357ac280b36e6c0 /actionwebservice | |
parent | 899c1b0157a1c8cb01673caaccfb589d743519a6 (diff) | |
download | rails-7cdd0d6ecf6afe0af98faf52e40b40deb5a15384.tar.gz rails-7cdd0d6ecf6afe0af98faf52e40b40deb5a15384.tar.bz2 rails-7cdd0d6ecf6afe0af98faf52e40b40deb5a15384.zip |
Don't convert value if it's already of an appropriate type.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5013 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionwebservice')
-rw-r--r-- | actionwebservice/lib/action_web_service/casting.rb | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/actionwebservice/lib/action_web_service/casting.rb b/actionwebservice/lib/action_web_service/casting.rb index 4fb5a8db25..71cdf4e055 100644 --- a/actionwebservice/lib/action_web_service/casting.rb +++ b/actionwebservice/lib/action_web_service/casting.rb @@ -96,14 +96,14 @@ module ActionWebService # :nodoc: when :float Float(value) when :time - value = "#{value['2']}/#{value['3']}/#{value['1']} #{value['4']}:#{value['5']}:#{value['6']}" if value.kind_of?(Hash) - Time.parse(value.to_s) + value = "%s/%s/%s %s:%s:%s" % value.values_at(*%w[2 3 1 4 5 6]) if value.kind_of?(Hash) + value.kind_of?(Time) ? value : Time.parse(value.to_s) when :date - value = "#{value['2']}/#{value['3']}/#{value['1']}" if value.kind_of?(Hash) - Date.parse(value.to_s) + value = "%s/%s/%s" % value.values_at(*%w[2 3 1]) if value.kind_of?(Hash) + value.kind_of?(Date) ? value : Date.parse(value.to_s) when :datetime - value = "#{value['2']}/#{value['3']}/#{value['1']} #{value['4']}:#{value['5']}:#{value['6']}" if value.kind_of?(Hash) - DateTime.parse(value.to_s) + value = "%s/%s/%s %s:%s:%s" % value.values_at(*%w[2 3 1 4 5 6]) if value.kind_of?(Hash) + value.kind_of?(DateTime) ? value : DateTime.parse(value.to_s) end end |