Closed prometh07 closed 7 years ago
I'm sorry but I would be inclined to say no to this feature. I want to keep tty-progressbar as is and give a full control so as to wrapping the progression logic. Having said, I think we could probably add automatic progression to this bar based on some conditions - see tty-spinner#auto_spin.
Unfortunately, I'm currently taking a leave from OSS contributions until next month so I won't be able to work on this library. But please submit PRs and I will review as soon as I can.
Initially I was reluctant to consider this as a good addition. However, after thinking about it I came round to actually liking this idea quite a bit. I think this simplifies a lot of use cases. I have added #iterate
message which you can read about in docs. I've also added example to demonstrate usage. I hope you will enjoy it!
I'm not sure whether it aligns with the gem's purpose, but I think it would be quite nice to have a built-in function wrapping an enumerable with a progressbar, so instead of manually advancing a progressbar with every iteration:
one could just call something like:
with_bar(enumerable).map { |v| computation(v) }
An example of a simple with_bar implementation:
Perhaps with_bar should take another argument, so one could customize a progressbar.
What do you think?