mirror of https://github.com/rails/rails
parent
c2dc793e59
commit
c07dff7227
|
@ -415,7 +415,7 @@ GEM
|
|||
rexml
|
||||
ruby-progressbar (~> 1.7)
|
||||
unicode-display_width (>= 1.4.0, < 2.0)
|
||||
rubocop-performance (1.6.0)
|
||||
rubocop-performance (1.6.1)
|
||||
rubocop (>= 0.71.0)
|
||||
rubocop-rails (2.5.2)
|
||||
activesupport
|
||||
|
|
|
@ -21,7 +21,7 @@ module ActiveRecord
|
|||
alias :array? :array
|
||||
|
||||
def sql_type
|
||||
super.sub(/\[\]\z/, "")
|
||||
super.delete_suffix("[]")
|
||||
end
|
||||
|
||||
def init_with(coder)
|
||||
|
|
|
@ -544,7 +544,7 @@ module ActiveSupport #:nodoc:
|
|||
|
||||
if file_path
|
||||
expanded = File.expand_path(file_path)
|
||||
expanded.sub!(/\.rb\z/, "")
|
||||
expanded.delete_suffix!(".rb")
|
||||
|
||||
if loading.include?(expanded)
|
||||
raise "Circular dependency detected while autoloading constant #{qualified_name}"
|
||||
|
@ -733,7 +733,7 @@ module ActiveSupport #:nodoc:
|
|||
|
||||
def remove_constant(const) #:nodoc:
|
||||
# Normalize ::Foo, ::Object::Foo, Object::Foo, Object::Object::Foo, etc. as Foo.
|
||||
normalized = const.to_s.sub(/\A::/, "")
|
||||
normalized = const.to_s.delete_prefix("::")
|
||||
normalized.sub!(/\A(Object::)+/, "")
|
||||
|
||||
constants = normalized.split("::")
|
||||
|
@ -743,7 +743,7 @@ module ActiveSupport #:nodoc:
|
|||
file_path = search_for_file(const.underscore)
|
||||
if file_path
|
||||
expanded = File.expand_path(file_path)
|
||||
expanded.sub!(/\.rb\z/, "")
|
||||
expanded.delete_suffix!(".rb")
|
||||
loaded.delete(expanded)
|
||||
end
|
||||
|
||||
|
|
|
@ -160,7 +160,7 @@ module ActiveSupport
|
|||
end
|
||||
|
||||
def normalize_extension(ext)
|
||||
ext.to_s.sub(/\A\./, "")
|
||||
ext.to_s.delete_prefix(".")
|
||||
end
|
||||
|
||||
# Given a collection of Pathname objects returns the longest subpath
|
||||
|
|
|
@ -133,7 +133,7 @@ module ActiveSupport
|
|||
|
||||
result.sub!(/\A_+/, "")
|
||||
unless keep_id_suffix
|
||||
result.sub!(/_id\z/, "")
|
||||
result.delete_suffix!("_id")
|
||||
end
|
||||
result.tr!("_", " ")
|
||||
|
||||
|
|
|
@ -129,7 +129,7 @@ module RailsGuides
|
|||
if guide.end_with?(".md")
|
||||
guide.sub(/md\z/, "html")
|
||||
else
|
||||
guide.sub(/\.erb\z/, "")
|
||||
guide.delete_suffix(".erb")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ class CodeStatisticsCalculator #:nodoc:
|
|||
if file_path.end_with? "_test.rb"
|
||||
:minitest
|
||||
else
|
||||
File.extname(file_path).sub(/\A\./, "").downcase.to_sym
|
||||
File.extname(file_path).delete_prefix(".").downcase.to_sym
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue