tag:blogger.com,1999:blog-6666038.post115548885062128163..comments2008-07-02T03:29:47.642-04:00Comments on Archimedes Trajano: Third ruby scriptArchimedes Trajanohttp://www.blogger.com/profile/15993184075121538415noreply@blogger.comBlogger3125tag:blogger.com,1999:blog-6666038.post-76074768441126506882008-07-02T03:29:00.000-04:002008-07-02T03:29:00.000-04:00Thanks all,@JeremyI do like the braces. I am just...Thanks all,<BR/><BR/>@Jeremy<BR/>I do like the braces. I am just determining on which one is the "recommended norm"<BR/><BR/>@manveru<BR/>Thanks for the even simplified version.Archimedes Trajanohttp://www.blogger.com/profile/15993184075121538415noreply@blogger.comtag:blogger.com,1999:blog-6666038.post-58344885676088900832007-05-30T17:57:00.000-04:002007-05-30T17:57:00.000-04:00I noticed a few things about your script, and as a...I noticed a few things about your script, and as a Rubyist I thought I might point some stuff out. Though your post is kind of old, so this all may be irrelevant, I still wanted to see if I could help you out.<BR/>1. the braces {} are quite helpful still. You don't need to stop using them. array.each { |a| puts a } you can do this all on one line instead of doing using the do and end statements.<BR/>2. Since I know some other language I can see how the require can be a bit taxing. The good thing though is you only have to do it once, and since it's the file name it can be either what ever you want it to be i.e. the object you are using or some ruby class that doesn't change. As of this post it looks like you haven't got into ruby classes yet, but generally you want 1 class to be in each file unless the classes are closely related or something like that. I see that more in Rails than anything.<BR/>3. you can use a for statement in ruby like for product in products and so on.<BR/>4. You don't have to require "tmpdir" just to use the Dir class. it's already available to you.<BR/><BR/>Happy programming.Jeremyhttp://www.blogger.com/profile/10053945634106101288noreply@blogger.comtag:blogger.com,1999:blog-6666038.post-39000567646446296652007-04-30T19:28:00.000-04:002007-04-30T19:28:00.000-04:00This snippet is another beautified version ;)<A HREF="http://pastie.caboo.se/57812" REL="nofollow">This snippet</A> is another beautified version ;)manveruhttp://www.blogger.com/profile/11571653731549977710noreply@blogger.com