24
19

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

進捗率を表示するための ruby-progressbar gem を試す #ruby

Last updated at Posted at 2015-04-23

:gem: 概要

進捗率を表示するための ruby-progressbar gem を試しました

インストール

$ gem install ruby-progressbar

サンプル1

デフォルトで実行

サンプルコード

require "ruby-progressbar"

pb = ProgressBar.create
10.times do
  pb.increment
  sleep 0.1
end
pb.finish
  • 出力確認

sample1.gif

サンプル2

様々なオプションを利用。
オプションの仕様は 公式 Wiki 参照

サンプルコード

require "ruby-progressbar"

pb = ProgressBar.create(
  :title => "(^_^)",
  :starting_at => 100,
  :progress_mark => '>',
  :remainder_mark => '#',
  :format => '%t: S%BE :%t',
  :total => 200,
  :length => 50
)

10.times do
  pb.progress += 10
  sleep 0.1
end
pb.finish
  • 出力確認

sample2.gif

:books: 外部資料

24
19
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
24
19

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?