0.0
No commit activity in last 3 years
No release in over 3 years
Each_with_anim is easiest to make progress bar and other cool animations in CUI.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

~> 1.10
~> 10.0
>= 0
 Project Readme

each_with_anim

RubyのCUI上でループ時のアニメーションが簡単に作れるメソッドです。
ループが終了する予測時間も測定してくれます。

Each_with_anim is easiest to make progress bar and other cool animations in CUI.

anim

Installation

$ gem install each_with_anim

Usage

each_with_animは,アニメーションを表示する以外は基本的にeachと同じ振る舞いをします。
Use "each_with_anim" like "each" method.

require "each_with_anim"

list = %w(hage hoge foo) * 1000
list.each_with_anim do |elem|
  #something
end

もちろんwith_indexとかも使えます。
あとeach_with_animationはeach_with_animのエイリアスになってます。ただ長いので非推奨。
also, if you want to use "with_index",

list = %w(hage hoge foo) * 1000
list.each_with_animation.with_index do |elem,i|
  #something
end

同様に,引数を取ってアニメーションを変えることができます。今はまだ2つだけ。
暇なときに増やして行きます。
if you want to change animation,

list = %w(hage hoge foo) * 1000
list.each_with_anim(1) do |elem|
  #something
end

change_anim

Problem

each_with_anim内でprintすると表示がバグります。
解決策を絶賛探し中。

list = %w(hage hoge foo) * 10
list.each_with_anim do |elem|
    puts "piyoo"
end

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/7rpn/each_with_anim. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

なんでもok
すごい顔文字師がいたら助けてください笑

License

The gem is available as open source under the terms of the MIT License.

自由に使ってください。