method
remove_sql_header_comments
v5.1.7 -
Show latest stable
- Class:
ActiveRecord::Tasks::PostgreSQLDatabaseTasks
remove_sql_header_comments(filename)private
No documentation available.
# File activerecord/lib/active_record/tasks/postgresql_database_tasks.rb, line 118
def remove_sql_header_comments(filename)
removing_comments = true
tempfile = Tempfile.open("uncommented_structure.sql")
begin
File.foreach(filename) do |line|
unless removing_comments && (line.start_with?(SQL_COMMENT_BEGIN) || line.blank?)
tempfile << line
removing_comments = false
end
end
ensure
tempfile.close
end
FileUtils.mv(tempfile.path, filename)
end