Use this template for your progressbar needs in ruby. Highly modifiable, always useful, easy to forget. The Ruby progressbar is...a tool you can use.
- Up top in your file, require the
ruby-progressbar
gem - Construct a query worth tracking the progress of
- Use the progressbar template below
- Enjoy peace of mind knowing exactly how long your process will take
- Modify the code below to fit your use case
require 'ruby-progressbar'
query = Person.where.not(last_name: "Bigalow")
progress = ProgressBar.create(
total: query.count,
format: "Progress: %a <%B> %p%% %t",
smoothing: 0.5
)
query.find_each do |person|
progress.increment
person.update!(first_name: "Duece")
end
Top comments (0)