
Issue #20056 has been updated by zverok (Victor Shepelev). Status changed from Closed to Open Actually, I found _another_ inconsistency while writing docs. Not sure it is worth fixing, but still somewhat confusing: ```ruby Dir.chdir('doc') do |*args| p args #=> ["doc"] "res" end.tap { p _1 } #=> "res" Dir.new('doc').chdir do |*args| p args #=> [] "res" end.tap { p _1 } #=> nil Dir.fchdir(Dir.new('doc').fileno) do |*args| p args #=> [] "res" end.tap { p _1 } #=> "res" ``` The difference in args passing into a block might cause only mild confusion, but the fact that the `Dir#chdir` doesn't return the block result seems problematic. Unless I am missing something again. ---------------------------------------- Misc #20056: Dir#chdir inconsistency with Dir.chdir https://bugs.ruby-lang.org/issues/20056#change-105629 * Author: zverok (Victor Shepelev) * Status: Open * Priority: Normal * Assignee: jeremyevans0 (Jeremy Evans) ---------------------------------------- I am not sure it is important; I just wanted to understand if this is intentional or accidental. 1. There is no block form for `Dir#chdir`, unlike `Dir.chdir` (the form that will return to the previous directory when the block is finished) 2. `Dir.chdir` returns `0`, while `Dir#chdir` returns `nil` (both seem to be not representing any particular internal value, just a hardcoded return value). -- https://bugs.ruby-lang.org/