diff options
author | Alex Weidmann <alex@twinsoftech.com> | 2014-10-02 17:35:13 -0600 |
---|---|---|
committer | Alex Weidmann <alex@twinsoftech.com> | 2014-10-02 17:35:13 -0600 |
commit | afb92754c86372d34b36f8a3d340277c21a9c0e8 (patch) | |
tree | 694c69dcde6f7ccfe6368e6a0562e2b30a165c7a /actionview/lib | |
parent | 4cd57a88b49e900f77514b3a8067854eb45e21a9 (diff) | |
download | rails-afb92754c86372d34b36f8a3d340277c21a9c0e8.tar.gz rails-afb92754c86372d34b36f8a3d340277c21a9c0e8.tar.bz2 rails-afb92754c86372d34b36f8a3d340277c21a9c0e8.zip |
Use #tr instead of #gsub where possible
Diffstat (limited to 'actionview/lib')
-rw-r--r-- | actionview/lib/action_view/helpers/form_tag_helper.rb | 2 | ||||
-rw-r--r-- | actionview/lib/action_view/template.rb | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/actionview/lib/action_view/helpers/form_tag_helper.rb b/actionview/lib/action_view/helpers/form_tag_helper.rb index 7d1cdc5a68..ff5d278b85 100644 --- a/actionview/lib/action_view/helpers/form_tag_helper.rb +++ b/actionview/lib/action_view/helpers/form_tag_helper.rb @@ -862,7 +862,7 @@ module ActionView # see http://www.w3.org/TR/html4/types.html#type-name def sanitize_to_id(name) - name.to_s.delete(']').gsub(/[^-a-zA-Z0-9:.]/, "_") + name.to_s.delete(']').tr('^-a-zA-Z0-9:.', "_") end end end diff --git a/actionview/lib/action_view/template.rb b/actionview/lib/action_view/template.rb index f398f9bfa3..379f31bdaf 100644 --- a/actionview/lib/action_view/template.rb +++ b/actionview/lib/action_view/template.rb @@ -321,7 +321,7 @@ module ActionView end def identifier_method_name #:nodoc: - inspect.gsub(/[^a-z_]/, '_') + inspect.tr('^a-z_', '_') end def instrument(action, &block) |