diff options
author | brainopia <brainopia@evilmartians.com> | 2015-04-02 02:11:07 +0300 |
---|---|---|
committer | brainopia <brainopia@evilmartians.com> | 2015-04-02 02:15:07 +0300 |
commit | 58d75fd8112d27c0f4bdd004e10b4f4e8b350595 (patch) | |
tree | 2708205fb412b55f1dea947da22aaed47c1fd485 /activerecord/lib/active_record/connection_adapters | |
parent | cdac52e124769909b6cb5fce2c4d00e09d21e059 (diff) | |
download | rails-58d75fd8112d27c0f4bdd004e10b4f4e8b350595.tar.gz rails-58d75fd8112d27c0f4bdd004e10b4f4e8b350595.tar.bz2 rails-58d75fd8112d27c0f4bdd004e10b4f4e8b350595.zip |
Freeze static arguments for gsub
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract/quoting.rb | 2 | ||||
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb b/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb index c228b39c26..91c7298983 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb @@ -77,7 +77,7 @@ module ActiveRecord # Quotes a string, escaping any ' (single quote) and \ (backslash) # characters. def quote_string(s) - s.gsub('\\', '\&\&').gsub("'", "''") # ' (for ruby-mode) + s.gsub('\\'.freeze, '\&\&'.freeze).gsub("'".freeze, "''".freeze) # ' (for ruby-mode) end # Quotes the column name. Defaults to no quoting. diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb index ebced66cb1..332ac9d88c 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb @@ -568,9 +568,9 @@ module ActiveRecord case default # Quoted types when /\A[\(B]?'(.*)'::/m - $1.gsub("''", "'") + $1.gsub("''".freeze, "'".freeze) # Boolean types - when 'true', 'false' + when 'true'.freeze, 'false'.freeze default # Numeric types when /\A\(?(-?\d+(\.\d*)?)\)?(::bigint)?\z/ |