class Df_entry
Attributes
available[R]
filesystem[R]
mounted_on[R]
size[R]
system[RW]
used[R]
used_percent[R]
Public Class Methods
new(string = nil, system = nil )
click to toggle source
# File lib/Linux/df_entry.rb, line 11 def initialize(string = nil, system = nil ) @system = system parse(string) unless string.nil? end
Public Instance Methods
parse(string)
click to toggle source
# File lib/Linux/df_entry.rb, line 18 def parse(string) regexp = %r{([\w\/\_\-]+)\s+ #Filesystem ([\d\.MGK]+)\s+ #Size ([\d\.MGK]+)\s+ #Used ([\d\.MGK]+)\s+ # Available (\d+)\%\s+ #Used procent ([\w\/]+)\s* #Mounted on }x match = regexp.match(string) unless match puts string puts regexp puts match puts "regexp couldn't decode string #{string}" raise end @filesystem = match[1] @size = match[2] @used = match[3] @available = match[4] @used_percent = match[5] @mounted_on = match[6] end