mirror of https://github.com/rails/rails
Change `gsub` to `tr` where possible
This commit is contained in:
parent
7b740f31cc
commit
8764ef95dc
|
@ -155,7 +155,7 @@ module ActionView
|
|||
test "view_assigns excludes internal ivars" do
|
||||
INTERNAL_IVARS.each do |ivar|
|
||||
assert defined?(ivar), "expected #{ivar} to be defined"
|
||||
assert !view_assigns.keys.include?(ivar.to_s.sub('@', '').to_sym), "expected #{ivar} to be excluded from view_assigns"
|
||||
assert !view_assigns.keys.include?(ivar.to_s.tr('@', '').to_sym), "expected #{ivar} to be excluded from view_assigns"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -11,7 +11,7 @@ module ActiveRecord::Associations::Builder
|
|||
end
|
||||
|
||||
def join_table
|
||||
@join_table ||= [@lhs_class.table_name, klass.table_name].sort.join("\0").gsub(/^(.*[._])(.+)\0\1(.+)/, '\1\2_\3').gsub("\0", "_")
|
||||
@join_table ||= [@lhs_class.table_name, klass.table_name].sort.join("\0").gsub(/^(.*[._])(.+)\0\1(.+)/, '\1\2_\3').tr("\0", "_")
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -63,7 +63,7 @@ module ActiveRecord
|
|||
# records, artists => artists_records
|
||||
# music_artists, music_records => music_artists_records
|
||||
def self.derive_join_table_name(first_table, second_table) # :nodoc:
|
||||
[first_table.to_s, second_table.to_s].sort.join("\0").gsub(/^(.*_)(.+)\0\1(.+)/, '\1\2_\3').gsub("\0", "_")
|
||||
[first_table.to_s, second_table.to_s].sort.join("\0").gsub(/^(.*_)(.+)\0\1(.+)/, '\1\2_\3').tr("\0", "_")
|
||||
end
|
||||
|
||||
module ClassMethods
|
||||
|
|
|
@ -184,7 +184,7 @@ module ActiveSupport
|
|||
}
|
||||
|
||||
UTC_OFFSET_WITH_COLON = '%s%02d:%02d'
|
||||
UTC_OFFSET_WITHOUT_COLON = UTC_OFFSET_WITH_COLON.sub(':', '')
|
||||
UTC_OFFSET_WITHOUT_COLON = UTC_OFFSET_WITH_COLON.tr(':', '')
|
||||
|
||||
@lazy_zones_map = ThreadSafe::Cache.new
|
||||
|
||||
|
|
Loading…
Reference in New Issue