# Worked on osx class Disk @@disk_usage def initialize @@disk_usage = `/bin/df -h|awk '{print $1","$2","$3","$4","$5","$6}'` end def parse @@disk_usage = @@disk_usage.split("\n") $return_data = {} $i = 0 @@disk_usage.each do |disk| disk = disk.split(",") if disk[0] != "Filesystem" and disk[0] != "map" $i += 1 $return_data[$i] = { 'Filesystem' => disk[0], 'Size' => disk[1], 'Used' => disk[2], 'Avail' => disk[3], 'Capacity' => disk[4], 'iused' => disk[5] } end end $return_data end end