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:
@@ -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
|
||||
|
Reference in New Issue
Block a user