1
0
mirror of https://github.com/OpenNebula/one.git synced 2024-12-27 03:21:29 +03:00

feature #788: Optional base unit for unit_to_str method

This commit is contained in:
Ruben S. Montero 2011-08-31 16:29:43 +02:00
parent c8f44ede9a
commit d488cffddc
2 changed files with 3 additions and 3 deletions

View File

@ -363,11 +363,11 @@ EOT
BinarySufix = ["K", "M", "G", "T" ]
def OpenNebulaHelper.unit_to_str(value, options)
def OpenNebulaHelper.unit_to_str(value, options, unit="K")
if options[:kilobytes]
value
else
i=0
i=BinarySufix.index(unit).to_i
while value > 1024 && i < 3 do
value /= 1024.0

View File

@ -130,7 +130,7 @@ class OneImageHelper < OpenNebulaHelper::OneHelper
column :SIZE, "Size of the image",
:size=>7 do |d|
OpenNebulaHelper.unit_to_str(d['SIZE'].to_i,options)
OpenNebulaHelper.unit_to_str(d['SIZE'].to_i,options,"M")
end
default :ID, :USER, :GROUP, :NAME, :SIZE, :TYPE, :REGTIME, :PUBLIC,