Revision 300c8b44
Added by Ohad Levy over 14 years ago
- ID 300c8b4459d11328735fee7558a65e49767b9b02
config/initializers/foreman.rb | ||
---|---|---|
logger.silence { super }
|
||
end
|
||
end
|
||
|
||
class String
|
||
def to_gb
|
||
begin
|
||
value,unit=self.match(/(\d+|.+) ([KMG]B)$/i)[1..2]
|
||
case unit.to_sym
|
||
when nil, :B, :byte then (value.to_f / 1000_000_000)
|
||
when :GB, :G, :gigabyte then value.to_f
|
||
when :MB, :M, :megabyte then (value.to_f / 1000)
|
||
when :KB, :K, :kilobyte, :kB then (value.to_f / 1000_000)
|
||
else raise "Unknown unit: #{unit.inspect}!"
|
||
end
|
||
rescue
|
||
raise "Unknown string"
|
||
end
|
||
end
|
||
end
|
Also available in: Unified diff
fixes #89 - this adds basic graphs and charts for your inventory, it
also includes minor changes to the dashboard graphs