From: cdc@...2go.com (Cliff Cyphers) Date: 2006-06-19T03:33:24+09:00 Subject: Re: Ruby in the sky with diamonds --DocE+STaALJfprDB Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Jun 19, 2006 at 03:22:15AM +0900, Gareth Clews wrote: > Hey there, sorry I'm a little new to ruby and need a tiny bit of help if= =20 > anyone can see to help thatd be great: First of off there's ignorance all throughout this post. >=20 > I better warn you now that this probably isnt going to be a short post! >=20 > 1. Say I have 5 files which just contains arrays, hashes or a mixture=20 > of both and I want to let somebody choose one of them: for example Um, files don't contain a data structure. You read data in from files into= a data structure (array, hash, etc..). >=20 >=20 > Code: > puts "Please make a choice from the 5 files" > choice =3D gets.chomp > Um, this is same concept as any language. 1. Open file 2. Read into data structure >=20 > then I want ruby/irb to output the hashes/arrays contained in the=20 > files, like the cat or less commands with bash, how do I go about this?! Iterate over the data structure and use one of the IO methods: puts, print, printf, etc.. >=20 > 2. I have created a qtruby/kde ruby (I use kdevelop so chose a kde=20 > application from the project wizard) project and created the main window= =20 > and given it a title/buttons etc but now I want to partition the main=20 > window into 4 or 5 smaller boxes which will display information (as=20 > opposed to taking data) upon clicking (I know how to caputre the mouse=20 > so thats not a problem) so how would I go about partitioning the window= =20 > into these boxes? (the size and position commands I'm safe with I just=20 > need to know how to create the subwindows) > Why post this to a Ruby list? This is a kdevelop/qt item and needs to be post to an appropriate list. > 3. An easier one methinks, how do I get irb to put what the contents of= =20 > a folder are and whether they are folders or files? (again kind of like= =20 > ls in bash) >=20 Need to gain more about basic principals. If you don't understand reading = of files and such same goes for getting the directories contents. Please see the programming ruby to clear up many of the falsities in this p= ost before asking for help. =20 --DocE+STaALJfprDB Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (GNU/Linux) iD8DBQFElZxwpXfXwRYlDA0RAsjwAJsFMLa0oemjyLcju/nAaFP74/XSBgCeNCcY Y9V8dTkGqn/IzPIj9gC+Khg= =HVLu -----END PGP SIGNATURE----- --DocE+STaALJfprDB--