Ruby progressbar template
chair
Posted on April 28, 2020
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
💖 💪 🙅 🚩
chair
Posted on April 28, 2020
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.