mirror of
https://github.com/neocities/neocities.git
synced 2025-06-28 23:23:22 +02:00
update plans for live data and extra fun things
This commit is contained in:
parent
f5bb352032
commit
8345b7aa04
2 changed files with 27 additions and 17 deletions
|
@ -1,5 +1,5 @@
|
|||
class Numeric
|
||||
ONE_MEGABYTE = 1048576
|
||||
ONE_MEGABYTE = 1000000
|
||||
|
||||
def roundup(nearest=10)
|
||||
self % nearest == 0 ? self : self + nearest - (self % nearest)
|
||||
|
@ -9,9 +9,19 @@ class Numeric
|
|||
self/ONE_MEGABYTE.to_f
|
||||
end
|
||||
|
||||
def to_space_pretty
|
||||
def to_bytes_pretty
|
||||
space = (self.to_f / ONE_MEGABYTE).round(2)
|
||||
space = space.to_i if space.denominator == 1
|
||||
"#{space} MB"
|
||||
if space >= 1000000
|
||||
"#{space/1000000} TB"
|
||||
elsif space >= 1000
|
||||
"#{space/1000} GB"
|
||||
else
|
||||
"#{space} MB"
|
||||
end
|
||||
end
|
||||
|
||||
def to_space_pretty
|
||||
to_bytes_pretty
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue