class Df

Attributes

system[W]
table[R]

Public Class Methods

new(string = nil, system = nil) click to toggle source
# File lib/Linux/df.rb, line 9
def initialize(string = nil, system = nil)

  @system = system
  @table = {}

  parse(string) unless string.nil?
end

Public Instance Methods

parse(string) click to toggle source
# File lib/Linux/df.rb, line 17
def parse(string)

  string.each_line do |s|

    next if s =~ /^\s*Filesystem\s+Size\s+Used\s+Avail\s+Use\%\s+Mounted\s+on\s*$/
    next if s =~ /^\s*Filesystem\s+1024\-blocks\s+Used\s+Available\s+Capacity\s+Mounted\s+on\s*$/

    entry = Df_entry.new(s, @system)
    @table[entry.mounted_on] = entry

  end

end