Sha256: 4406420628d3310839daec5a67b11b5a2b3c2a06e97d8277ae1ffbf1d42c012c

Contents?: true

Size: 651 Bytes

Versions: 59

Compression:

Stored size: 651 Bytes

Contents

# -*- coding: utf-8 -*-
#
# Copyright 2013 whiteleaf. All rights reserved.
#

require_relative "../progressbar"

#
# コンソール用のプログレスバーはWEB UIでは使えないため置き換える
#
class ProgressBar
  def self.push_server=(server)
    @@push_server = server
  end

  alias :original_initialize :initialize

  def initialize(*args)
    original_initialize(*args)
    @@push_server.send_all("progressbar.init" => true)
  end

  def output(num)
    percent = calc_ratio(num) * 100
    @@push_server.send_all("progressbar.step" => percent)
  end

  def clear
    @@push_server.send_all("progressbar.clear" => true)
  end
end

Version data entries

59 entries across 59 versions & 1 rubygems

Version Path
narou-3.2.5.1 lib/web/progressbar4web.rb
narou-3.2.5 lib/web/progressbar4web.rb
narou-3.2.4 lib/web/progressbar4web.rb
narou-3.2.3 lib/web/progressbar4web.rb
narou-3.2.2 lib/web/progressbar4web.rb
narou-3.2.1 lib/web/progressbar4web.rb
narou-3.2.0.1 lib/web/progressbar4web.rb
narou-3.2.0 lib/web/progressbar4web.rb
narou-3.1.11 lib/web/progressbar4web.rb
narou-3.1.10 lib/web/progressbar4web.rb
narou-3.1.9 lib/web/progressbar4web.rb
narou-3.1.8 lib/web/progressbar4web.rb
narou-3.1.7 lib/web/progressbar4web.rb
narou-3.1.6 lib/web/progressbar4web.rb
narou-3.1.5 lib/web/progressbar4web.rb
narou-3.1.4 lib/web/progressbar4web.rb
narou-3.1.3 lib/web/progressbar4web.rb
narou-3.1.2 lib/web/progressbar4web.rb
narou-3.1.1 lib/web/progressbar4web.rb
narou-3.0.5.1 lib/web/progressbar4web.rb