New to Ruby, would like a style critique - filedup.rb [0/1]

I’ve just written my first Ruby application (all 135 lines of it) and
being totally book educated, I would love for a more accomplished Ruby
programmer just to look over and critique my work.

I really enjoy Ruby, but without some concrete feedback I fear I may not
quite “get” some of the features and style of the language. From
perusing the messages here, my request is far less heady than the
current topics of discussion…but I’m not sure where else to ask
(suggestions?) I’ve tried to find examples, but nothing seems as simple
as what I’m trying to do.

thanks,
jeff

I've just written my first Ruby application (all 135 lines of it) and
being totally book educated, I would love for a more accomplished Ruby
programmer just to look over and critique my work.

Well, perhaps it's best if you use 'find.rb' which come with ruby, rather
than your class FileList

# Usage:
# require "find"

···

#
# Find.find('/foo','/bar') {|f| ...}
# or
# include Find
# find('/foo','/bar') {|f| ...}
#

`f' will give you the pathname : you just need to retrieve filename
and path from it

Guy Decoux

ILikeFood wrote:

I’ve just written my first Ruby application (all 135 lines of it) and
being totally book educated, I would love for a more accomplished Ruby
programmer just to look over and critique my work.

One of the reasons to follow Guy’s advice and use “find.rb” is that it
wont recursively follow symlinks that point to a directory above. Your
code bails with “filedup.rb:62:in `open’: Too many open files - “.”
(Errno::EMFILE)” when given that test, while the find.rb code is not so
brittle.

– Douglas Hunter

personally i prefer

found = Dir[‘**/*’]

over

found = and Find.find (‘.’){|e| found << e}

it seems to work fine, following symlinks, recursing, etc. any drawbacks to
this?

assume you actually want a copy of found, rather tahn simply traversing the
tree with a block.

-a

···

On Sat, 1 Feb 2003, Douglas Hunter wrote:

ILikeFood wrote:

I’ve just written my first Ruby application (all 135 lines of it) and
being totally book educated, I would love for a more accomplished Ruby
programmer just to look over and critique my work.

One of the reasons to follow Guy’s advice and use “find.rb” is that it
wont recursively follow symlinks that point to a directory above. Your
code bails with “filedup.rb:62:in `open’: Too many open files - “.”
(Errno::EMFILE)” when given that test, while the find.rb code is not so
brittle.

====================================

Ara Howard
NOAA Forecast Systems Laboratory
Information and Technology Services
Data Systems Group
R/FST 325 Broadway
Boulder, CO 80305-3328
Email: ahoward@fsl.noaa.gov
Phone: 303-497-7238
Fax: 303-497-7259
====================================