Sha256: f0bb19903334a334c10146fbe4b0df55faa7843b4e67ee6d8873ed3873251f6c

Contents?: true

Size: 640 Bytes

Versions: 2

Compression:

Stored size: 640 Bytes

Contents

# 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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
miranda-0.0.3 lib/miranda/system/linux/disk.rb
miranda-0.0.2 lib/miranda/system/linux/disk.rb