< :the previous in number
^ :the list in numerical order
> :the next in number
P :the previous (in thread)
N :the next (in thread)
|<:the top of this thread
>|:the next thread
^ :the parent (reply-to)
_:the child (an article replying to this)
>:the elder article having the same parent
<:the youger article having the same parent
---:split window and show thread lists
| :split window (vertically) and show thread lists
~ :close the thread frame
.:the index
..:the index of indices
2007/10/18, Luis <lcrespom / gmail.com>:
> > The typical (and IIRC most efficient) idiom is to pass on the block
> > parameter:
> >
> > def foo(&b)
> > foo(&b)
> > end
>
> That looks nice and simple.
> Thanks!
>
>
> >
> > Another remark: it seems you are reinventing Find.find(). Why do you do
> > that?
> >
>
>
> As I said, the dir scanning was just an example of recursiveness.
> Still, I do need to scan a directory in a way that I get an array of
> files per each block call, and not one file at a time, because I want
> to compare the contents of a directory with other directory, in order
> to identify changed files, new files, deleted files, etc.
You can still build that with Find.find() which saves you the traversal code:
#!ruby
require 'find'
require 'pp'
ARGV.each do |dir|
list = Hash.new {|h,k| h[k] = []}
Find.find dir do |f|
d, b = File.split f
next if /^\.\.?$/ =~ b
list[d] << b
end
pp list
end
Cheers
robert