Use #tr instead of #gsub where possible

This commit is contained in:
Alex Weidmann 2014-10-02 17:35:13 -06:00
parent 4cd57a88b4
commit afb92754c8
2 changed files with 2 additions and 2 deletions

View File

@ -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

View File

@ -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)