1
0
mirror of https://github.com/cmur2/openvpn-status-web.git synced 2025-08-07 22:33:57 +02:00

gem: add rubocop and fix style

This commit is contained in:
cn
2020-03-02 01:57:58 +01:00
parent d959e7fe62
commit 140c60c753
11 changed files with 175 additions and 67 deletions

View File

@@ -1,16 +1,16 @@
class Integer
def as_bytes
return "1 Byte" if self == 1
label = ["Bytes", "KiB", "MiB", "GiB", "TiB"]
return '1 Byte' if self == 1
label = %w[Bytes KiB MiB GiB TiB]
i = 0
num = self.to_f
while num >= 1024 do
num = num / 1024
num = to_f
while num >= 1024
num /= 1024
i += 1
end
"#{format('%.2f', num)} #{label[i]}"
end
end