aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authornormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-11-21 23:13:16 +0000
committernormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-11-21 23:13:16 +0000
commitcb528ff3c1a9e5a9a939e299b0faf10360d1292d (patch)
treebdb141407c053db2f856136fc7b46f9c72dd9bde /lib
parent24a7251eb04fc7b90e325c082a521f5b86020c3f (diff)
downloadruby-cb528ff3c1a9e5a9a939e299b0faf10360d1292d.tar.gz
lib/open3: favor symbol proc when possible
It reduces both human and machine code; as well as reducing the confusion from variable naming. * lib/open3.rb (popen_run, pipeline, pipeline_run): avoid capture git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56866 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/open3.rb12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/open3.rb b/lib/open3.rb
index ddfad66436..5ff1012b70 100644
--- a/lib/open3.rb
+++ b/lib/open3.rb
@@ -198,13 +198,13 @@ module Open3
end
pid = spawn(*cmd, opts)
wait_thr = Process.detach(pid)
- child_io.each {|io| io.close }
+ child_io.each(&:close)
result = [*parent_io, wait_thr]
if defined? yield
begin
return yield(*result)
ensure
- parent_io.each{|io| io.close }
+ parent_io.each(&:close)
wait_thr.join
end
end
@@ -601,7 +601,7 @@ module Open3
#
def pipeline(*cmds, **opts)
pipeline_run(cmds, opts, [], []) {|ts|
- ts.map {|t| t.value }
+ ts.map(&:value)
}
end
module_function :pipeline
@@ -650,13 +650,13 @@ module Open3
r = r2
}
result = parent_io + [wait_thrs]
- child_io.each {|io| io.close }
+ child_io.each(&:close)
if defined? yield
begin
return yield(*result)
ensure
- parent_io.each{|io| io.close }
- wait_thrs.each {|t| t.join }
+ parent_io.each(&:close)
+ wait_thrs.each(&:join)
end
end
result