lib/shell.rb in shell-0.7 vs lib/shell.rb in shell-0.8.0
- old
+ new
@@ -261,11 +261,11 @@
# If called as iterator, it restores the current directory when the
# block ends.
def chdir(path = nil, verbose = @verbose)
check_point
- if iterator?
+ if block_given?
notify("chdir(with block) #{path}") if verbose
cwd_old = @cwd
begin
chdir(path, nil)
yield
@@ -295,11 +295,11 @@
#
# If a block is given, it restores the current directory when the block ends.
def pushdir(path = nil, verbose = @verbose)
check_point
- if iterator?
+ if block_given?
notify("pushdir(with block) #{path}") if verbose
pushdir(path, nil)
begin
yield
ensure
@@ -444,10 +444,10 @@
prefix = "shell: "
end
_head = true
STDERR.print opts.collect{|mes|
mes = mes.dup
- yield mes if iterator?
+ yield mes if block_given?
if _head
_head = false
prefix + mes
else
" "* prefix.size + mes