Minipush: Fix error in displaying number of pushed KiB
parent
0a609aa1a0
commit
37b4d8d51e
Binary file not shown.
Before Width: | Height: | Size: 250 KiB After Width: | Height: | Size: 203 KiB |
@ -0,0 +1,29 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
# SPDX-License-Identifier: MIT OR Apache-2.0
|
||||||
|
#
|
||||||
|
# Copyright (c) 2020 Andre Richter <andre.o.richter@gmail.com>
|
||||||
|
|
||||||
|
# Monkey-patch ruby-progressbar so that it supports reporting the progress in KiB instead of Byte.
|
||||||
|
|
||||||
|
class ProgressBar
|
||||||
|
# Add kibi version of progress
|
||||||
|
class Progress
|
||||||
|
def progress_kibi
|
||||||
|
@progress / 1024
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
module Format
|
||||||
|
# Add new formatting option
|
||||||
|
class Molecule
|
||||||
|
MOLECULES_EXTENDED = MOLECULES.dup
|
||||||
|
MOLECULES_EXTENDED[:k] = %i[progressable progress_kibi]
|
||||||
|
|
||||||
|
def initialize(letter)
|
||||||
|
self.key = letter
|
||||||
|
self.method_name = MOLECULES_EXTENDED.fetch(key.to_sym)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in New Issue