aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2010-10-12 11:55:52 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2010-10-12 11:55:52 -0700
commit01893f43f68f3cba24751022131d51702d188979 (patch)
tree2db6909907790d298957b25dccd7e6f7fe428c45 /activerecord/lib/active_record/connection_adapters/abstract/quoting.rb
parent9852a724177cb5f65d5b37c0511cfacea2a3ebb6 (diff)
downloadrails-01893f43f68f3cba24751022131d51702d188979.tar.gz
rails-01893f43f68f3cba24751022131d51702d188979.tar.bz2
rails-01893f43f68f3cba24751022131d51702d188979.zip
reducing comparisons in when statements
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/abstract/quoting.rb')
-rw-r--r--activerecord/lib/active_record/connection_adapters/abstract/quoting.rb12
1 files changed, 6 insertions, 6 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb b/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb
index 603e4de564..b28eb3f758 100644
--- a/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb
+++ b/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb
@@ -22,13 +22,13 @@ module ActiveRecord
"'#{quote_string(value)}'" # ' (for ruby-mode)
end
- when NilClass then "NULL"
- when TrueClass then (column && column.type == :integer ? '1' : quoted_true)
- when FalseClass then (column && column.type == :integer ? '0' : quoted_false)
- when Float, Fixnum, Bignum then value.to_s
+ when nil then "NULL"
+ when true then (column && column.type == :integer ? '1' : quoted_true)
+ when false then (column && column.type == :integer ? '0' : quoted_false)
# BigDecimals need to be put in a non-normalized form and quoted.
- when BigDecimal then value.to_s('F')
- when Date, Time, DateTime then "'#{quoted_date(value)}'"
+ when BigDecimal then value.to_s('F')
+ when Numeric then value.to_s
+ when Date, Time then "'#{quoted_date(value)}'"
else
"'#{quote_string(value.to_s)}'"
end