Overloading example

Hello ruby-talk,

from shell.rb:

···

def pushdir(path = nil)
if iterator?
pushdir(path)
begin
yield
ensure
popdir
end
elsif path
@dir_stack.push @cwd
chdir path
notify “dir stack: [#{@dir_stack.join ', '}]”
self
else
if pop = @dir_stack.pop
@dir_stack.push @cwd
chdir pop
notify “dir stack: [#{@dir_stack.join ', '}]”
self
else
Shell.Fail DirStackEmpty
end
end
end


Best regards,
Bulat mailto:bulatz@integ.ru