From: "Daniel P. Zepeda" Date: 2002-01-01T07:58:48+09:00 Subject: [ruby-talk:29908] Re: How to check free diskspace? On Tue, 1 Jan 2002 06:59:26 +0900 Mathieu Bouchard wrote: > > On Tue, 1 Jan 2002, Le Wang wrote: > > Hi all, > > I've checked "Programming Ruby", and searched the ML to no avail. So > > how do you check free disk space, other than to parse 'df' output? > > Mount = Struct.new( > :device, > :path, > :fs_type, > :options, > :freq, > :passno) > > mounts = File.open("/etc/mtab") {|f| > f.map {|x| > Mount.new(*x.chomp.split) }} What does the '*' mean in this context? I've seen this idiom a couple of times on this list. I've tried the above code with and without the '*' and have noted that with the '*', each element from the split gets assigned to each part of the Struct, while an array gets assigned to just the first value of the Struct without the '*'. I understand what is doing, but *why* is it doing it? Is there somewhere this is documented (I must've missed it)? TIA > > ________________________________________________________________ > Mathieu Bouchard http://hostname.2y.net/~matju > -- Daniel P. Zepeda daniel@zepeda-zone.net