From: Toki Toki Date: 2008-04-28T05:54:21+09:00 Subject: Re: Free disk space with VMI in megabyte Michael Brooks wrote: > > Hello Toki: > > The drive.FreeSpace is being returned as a string (which may also be a > nil). Change #{drive.FreeSpace} to #{drive.FreeSpace.class} to see what > I mean. You'll need to convert the FreeSpace to a number before you can > use math operators / functions with it. Below is an example of how to > do that with the #to_f (aka "to float") method: > > disk.each {|drive| puts "#{drive.DeviceID} #{(drive.FreeSpace.to_f / > 1024) / 1024}"} > > Hope that helps, > > Michael Thanks a lot for the help and the explanation, I didn't know that "FreeSpace" by default is returned as a string. Best regards. -- Posted via http://www.ruby-forum.com/.