On 12/20/2011 10:12 AM, Leo M. wrote:
> Like the shell?
If you're asking about my efficiency comment, check out the glob and
similar methods in the Dir class:
http://rubydoc.info/stdlib/core/1.9.2/Dir.glob
It's possible to skip Ruby entirely and use just the shell for many
things, and you may find that to be more efficient by some measures
depending on your needs. My comment, however, was more about avoiding
calling out to external programs when Ruby itself offers similar
functionality built-in. In this case, calling ls is needlessly wasteful.
Whether or not you should call out to external programs for processing
of data will vary on a number of factors; including performance,
availability, cross platform compatibility, and ease of output
consumption to name a few. Be mindful of that when you start coding
calls to such programs. :-)
-Jeremy