Project

General

Profile

Actions

Bug #10815

closed

Dir.foreach in block form does not allow encoding

Added by djberg96 (Daniel Berger) about 10 years ago. Updated about 10 years ago.

Status:
Rejected
Assignee:
-
Target version:
-
ruby -v:
ruby 2.2.0p0 (2014-12-25 revision 49005) [i386-mswin32_120]
[ruby-core:67938]

Description

It doesn't appear that Dir.foreach{} allows an encoding:

enc = Encoding::UTF_16LE

# Without a block, works ok
p Dir.foreach(Dir.pwd)      # => Enumerator
p Dir.foreach(Dir.pwd, enc) # => Enumerator

# With a block, fails if more than 1 argument is passed
p Dir.foreach(Dir.pwd){ }      # => nil
p Dir.foreach(Dir.pwd, enc){ } # => ArgumentError
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0