method
remove_prefix_and_suffix
v7.1.3.4 -
Show latest stable
- Class:
ActiveRecord::SchemaDumper
remove_prefix_and_suffix(table)private
No documentation available.
# File activerecord/lib/active_record/schema_dumper.rb, line 333
def remove_prefix_and_suffix(table)
# This method appears at the top when profiling active_record test cases run.
# Avoid costly calculation when there are no prefix and suffix.
return table if @options[:table_name_prefix].blank? && @options[:table_name_suffix].blank?
prefix = Regexp.escape(@options[:table_name_prefix].to_s)
suffix = Regexp.escape(@options[:table_name_suffix].to_s)
table.sub(/\A#{prefix}(.+)#{suffix}\z/, "\\1")
end