Project

General

Profile

« Previous | Next » 

Revision a5da258d

Added by Jacob McCann almost 12 years ago

  • ID a5da258d392e44e48ecc502c9dac48c261703ee0

fixes #1656 add support for systems with terabytes of memory

View differences:

lib/core_extensions.rb
class String
def to_gb
begin
value,f,unit=self.match(/(\d+(\.\d+)?) ?(([KMG]B?|B))$/i)[1..3]
value,f,unit=self.match(/(\d+(\.\d+)?) ?(([KMGT]B?|B))$/i)[1..3]
case unit.to_sym
when nil, :B, :byte then (value.to_f / 1000_000_000)
when :TB, :T, :terabyte then (value.to_f * 1000)
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)
......
def are_all_conflicts?
self[:conflict].count == self.count
end
end
end

Also available in: Unified diff