Method: Usagewatch.uw_diskused_on
- Defined in:
- lib/usagewatch_ext/mac.rb
.uw_diskused_on(location) ⇒ Object
Show disk space used on location(partition) in GB
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/usagewatch_ext/mac.rb', line 17 def self.uw_diskused_on(location) df = `df` df.split("\n")[1..-1].each do |line| parts = line.split(" ") if parts.last == location diskusedon = ((parts[2].to_i.round(2)/1024)/1024).round(2) break end end diskusedon ? diskusedon : "location invalid" end |