* [ruby-dev:49135] [Ruby trunk - Feature #11302] [Assigned] Dir.entries and Dir.foreach without [".", ".."]
[not found] <redmine.issue-11302.20150624062458@ruby-lang.org>
@ 2015-06-24 6:24 ` naruse
2015-06-24 6:41 ` [ruby-dev:49136] [Ruby trunk - Feature #11302] " nobu
` (7 subsequent siblings)
8 siblings, 0 replies; 9+ messages in thread
From: naruse @ 2015-06-24 6:24 UTC (permalink / raw
To: ruby-dev
Issue #11302 has been reported by Yui NARUSE.
----------------------------------------
Feature #11302: Dir.entries and Dir.foreach without [".", ".."]
https://bugs.ruby-lang.org/issues/11302
* Author: Yui NARUSE
* Status: Assigned
* Priority: Normal
* Assignee: Yukihiro Matsumoto
----------------------------------------
Dir.entries returns an array of its content with "." and "..".
But as far as I met, almost all cases don't need them.
How about adding such new method or options?
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 9+ messages in thread
* [ruby-dev:49136] [Ruby trunk - Feature #11302] Dir.entries and Dir.foreach without [".", ".."]
[not found] <redmine.issue-11302.20150624062458@ruby-lang.org>
2015-06-24 6:24 ` [ruby-dev:49135] [Ruby trunk - Feature #11302] [Assigned] Dir.entries and Dir.foreach without [".", ".."] naruse
@ 2015-06-24 6:41 ` nobu
2015-06-24 15:44 ` [ruby-dev:49138] " josh.guthrie+ruby
` (6 subsequent siblings)
8 siblings, 0 replies; 9+ messages in thread
From: nobu @ 2015-06-24 6:41 UTC (permalink / raw
To: ruby-dev
Issue #11302 has been updated by Nobuyoshi Nakada.
Candidates for the methods or options?
I prefer a same option for both methods, but no concrete idea.
----------------------------------------
Feature #11302: Dir.entries and Dir.foreach without [".", ".."]
https://bugs.ruby-lang.org/issues/11302#change-53104
* Author: Yui NARUSE
* Status: Assigned
* Priority: Normal
* Assignee: Yukihiro Matsumoto
----------------------------------------
Dir.entries returns an array of its content with "." and "..".
But as far as I met, almost all cases don't need them.
How about adding such new method or options?
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 9+ messages in thread
* [ruby-dev:49138] [Ruby trunk - Feature #11302] Dir.entries and Dir.foreach without [".", ".."]
[not found] <redmine.issue-11302.20150624062458@ruby-lang.org>
2015-06-24 6:24 ` [ruby-dev:49135] [Ruby trunk - Feature #11302] [Assigned] Dir.entries and Dir.foreach without [".", ".."] naruse
2015-06-24 6:41 ` [ruby-dev:49136] [Ruby trunk - Feature #11302] " nobu
@ 2015-06-24 15:44 ` josh.guthrie+ruby
2017-03-19 5:10 ` [ruby-dev:50021] [Ruby trunk Feature#11302] " hi
` (5 subsequent siblings)
8 siblings, 0 replies; 9+ messages in thread
From: josh.guthrie+ruby @ 2015-06-24 15:44 UTC (permalink / raw
To: ruby-dev
Issue #11302 has been updated by Arnaud Rouyer.
Nobuyoshi Nakada wrote:
> Candidates for the methods or options?
>
> I prefer a same option for both methods, but no concrete idea.
Dir.foreach and Dir.entries both support a second hash argument for options: as of 2.2.2, the docs only mention the :encoding key in the options hash.
Basing myself on the GNU ls util, I propose supporting an :ignore key in the optional hash argument.
We could have an API similar to this:
~~~
$ ls -a
.
..
.hidden_file
directory
file.bin
$ irb
irb:001> Dir.entries('.')
=> [".", "..", ".hidden_file", "directory", "file.bin"]
irb:002> Dir.entries('.', ignore: :almost_all) # almost_all option name taken from GNU ls option name
=> [".hidden_file", "directory", "file.bin"] # http://git.savannah.gnu.org/cgit/coreutils.git/tree/src/ls.c#n4784
irb:003> Dir.entries('.', ignore: :directories)
=> [".hidden_file", "file.bin"]
irb:004> Dir.entries('.', ignore: :hidden)
=> ["directory", "file.bin"]
# Fancy proposal
irb:005> Dir.entries('.', ignore: /o/)
=> [".", "..", ".hidden_file", "file.bin"]
~~~
----------------------------------------
Feature #11302: Dir.entries and Dir.foreach without [".", ".."]
https://bugs.ruby-lang.org/issues/11302#change-53113
* Author: Yui NARUSE
* Status: Assigned
* Priority: Normal
* Assignee: Yukihiro Matsumoto
----------------------------------------
Dir.entries returns an array of its content with "." and "..".
But as far as I met, almost all cases don't need them.
How about adding such new method or options?
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 9+ messages in thread
* [ruby-dev:50021] [Ruby trunk Feature#11302] Dir.entries and Dir.foreach without [".", ".."]
[not found] <redmine.issue-11302.20150624062458@ruby-lang.org>
` (2 preceding siblings ...)
2015-06-24 15:44 ` [ruby-dev:49138] " josh.guthrie+ruby
@ 2017-03-19 5:10 ` hi
2017-04-19 2:06 ` [ruby-dev:50087] " nobu
` (4 subsequent siblings)
8 siblings, 0 replies; 9+ messages in thread
From: hi @ 2017-03-19 5:10 UTC (permalink / raw
To: ruby-dev
Issue #11302 has been updated by olivierlacan (Olivier Lacan).
red (Arnaud Rouyer) wrote:
> Basing myself on the GNU ls util, I propose supporting an :ignore key in the optional hash argument.
I very much like this. I just ran into this issue myself today having to remove `.` and `..` from `Dir.entries` output.
I don't think the `ignore` option accepting a regex is fancy at all, it makes a ton of sense. An array should also be acceptable considering that `Dir.entries('.', ignore: %w[. ..])` would become equivalent to:
```
Dir.entries('.') - %w[. ..]
```
I find it quite elegant, and certainly a lot more discoverable than GNU ls style arguments. :-)
----------------------------------------
Feature #11302: Dir.entries and Dir.foreach without [".", ".."]
https://bugs.ruby-lang.org/issues/11302#change-63666
* Author: naruse (Yui NARUSE)
* Status: Assigned
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* Target version:
----------------------------------------
Dir.entries returns an array of its content with "." and "..".
But as far as I met, almost all cases don't need them.
How about adding such new method or options?
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 9+ messages in thread
* [ruby-dev:50087] [Ruby trunk Feature#11302] Dir.entries and Dir.foreach without [".", ".."]
[not found] <redmine.issue-11302.20150624062458@ruby-lang.org>
` (3 preceding siblings ...)
2017-03-19 5:10 ` [ruby-dev:50021] [Ruby trunk Feature#11302] " hi
@ 2017-04-19 2:06 ` nobu
2017-05-19 9:01 ` [ruby-dev:50126] " akr
` (3 subsequent siblings)
8 siblings, 0 replies; 9+ messages in thread
From: nobu @ 2017-04-19 2:06 UTC (permalink / raw
To: ruby-dev
Issue #11302 has been updated by nobu (Nobuyoshi Nakada).
red (Arnaud Rouyer) wrote:
> Basing myself on the GNU ls util, I propose supporting an `:ignore` key in the optional hash argument.
> ~~~ruby
> irb:002> Dir.entries('.', ignore: :almost_all) # almost_all option name taken from GNU ls option name
`ignore: :almost_all` seems like that almost all files will be ignored and only '.' and '..' will be returned.
----------------------------------------
Feature #11302: Dir.entries and Dir.foreach without [".", ".."]
https://bugs.ruby-lang.org/issues/11302#change-64380
* Author: naruse (Yui NARUSE)
* Status: Assigned
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* Target version:
----------------------------------------
Dir.entries returns an array of its content with "." and "..".
But as far as I met, almost all cases don't need them.
How about adding such new method or options?
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 9+ messages in thread
* [ruby-dev:50126] [Ruby trunk Feature#11302] Dir.entries and Dir.foreach without [".", ".."]
[not found] <redmine.issue-11302.20150624062458@ruby-lang.org>
` (4 preceding siblings ...)
2017-04-19 2:06 ` [ruby-dev:50087] " nobu
@ 2017-05-19 9:01 ` akr
2017-05-19 9:06 ` [ruby-dev:50127] " shyouhei
` (2 subsequent siblings)
8 siblings, 0 replies; 9+ messages in thread
From: akr @ 2017-05-19 9:01 UTC (permalink / raw
To: ruby-dev
Issue #11302 has been updated by akr (Akira Tanaka).
There is Pathname#children and Pathname#each_child.
How about Dir.children and Dir.each_child ?
----------------------------------------
Feature #11302: Dir.entries and Dir.foreach without [".", ".."]
https://bugs.ruby-lang.org/issues/11302#change-64936
* Author: naruse (Yui NARUSE)
* Status: Assigned
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* Target version:
----------------------------------------
Dir.entries returns an array of its content with "." and "..".
But as far as I met, almost all cases don't need them.
How about adding such new method or options?
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 9+ messages in thread
* [ruby-dev:50127] [Ruby trunk Feature#11302] Dir.entries and Dir.foreach without [".", ".."]
[not found] <redmine.issue-11302.20150624062458@ruby-lang.org>
` (5 preceding siblings ...)
2017-05-19 9:01 ` [ruby-dev:50126] " akr
@ 2017-05-19 9:06 ` shyouhei
2017-05-19 9:08 ` [ruby-dev:50128] " matz
2017-09-14 9:07 ` [ruby-dev:50242] " eregontp
8 siblings, 0 replies; 9+ messages in thread
From: shyouhei @ 2017-05-19 9:06 UTC (permalink / raw
To: ruby-dev
Issue #11302 has been updated by shyouhei (Shyouhei Urabe).
+1 for Dir.children
----------------------------------------
Feature #11302: Dir.entries and Dir.foreach without [".", ".."]
https://bugs.ruby-lang.org/issues/11302#change-64937
* Author: naruse (Yui NARUSE)
* Status: Assigned
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* Target version:
----------------------------------------
Dir.entries returns an array of its content with "." and "..".
But as far as I met, almost all cases don't need them.
How about adding such new method or options?
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 9+ messages in thread
* [ruby-dev:50128] [Ruby trunk Feature#11302] Dir.entries and Dir.foreach without [".", ".."]
[not found] <redmine.issue-11302.20150624062458@ruby-lang.org>
` (6 preceding siblings ...)
2017-05-19 9:06 ` [ruby-dev:50127] " shyouhei
@ 2017-05-19 9:08 ` matz
2017-09-14 9:07 ` [ruby-dev:50242] " eregontp
8 siblings, 0 replies; 9+ messages in thread
From: matz @ 2017-05-19 9:08 UTC (permalink / raw
To: ruby-dev
Issue #11302 has been updated by matz (Yukihiro Matsumoto).
Sounds good.
Matz.
----------------------------------------
Feature #11302: Dir.entries and Dir.foreach without [".", ".."]
https://bugs.ruby-lang.org/issues/11302#change-64938
* Author: naruse (Yui NARUSE)
* Status: Assigned
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* Target version:
----------------------------------------
Dir.entries returns an array of its content with "." and "..".
But as far as I met, almost all cases don't need them.
How about adding such new method or options?
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 9+ messages in thread
* [ruby-dev:50242] [Ruby trunk Feature#11302] Dir.entries and Dir.foreach without [".", ".."]
[not found] <redmine.issue-11302.20150624062458@ruby-lang.org>
` (7 preceding siblings ...)
2017-05-19 9:08 ` [ruby-dev:50128] " matz
@ 2017-09-14 9:07 ` eregontp
8 siblings, 0 replies; 9+ messages in thread
From: eregontp @ 2017-09-14 9:07 UTC (permalink / raw
To: ruby-dev
Issue #11302 has been updated by Eregon (Benoit Daloze).
The decision here is surprising given https://bugs.ruby-lang.org/issues/13789#note-3
but nevertheless I'm very happy this got accepted.
----------------------------------------
Feature #11302: Dir.entries and Dir.foreach without [".", ".."]
https://bugs.ruby-lang.org/issues/11302#change-66653
* Author: naruse (Yui NARUSE)
* Status: Closed
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* Target version:
----------------------------------------
Dir.entries returns an array of its content with "." and "..".
But as far as I met, almost all cases don't need them.
How about adding such new method or options?
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2017-09-14 9:07 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <redmine.issue-11302.20150624062458@ruby-lang.org>
2015-06-24 6:24 ` [ruby-dev:49135] [Ruby trunk - Feature #11302] [Assigned] Dir.entries and Dir.foreach without [".", ".."] naruse
2015-06-24 6:41 ` [ruby-dev:49136] [Ruby trunk - Feature #11302] " nobu
2015-06-24 15:44 ` [ruby-dev:49138] " josh.guthrie+ruby
2017-03-19 5:10 ` [ruby-dev:50021] [Ruby trunk Feature#11302] " hi
2017-04-19 2:06 ` [ruby-dev:50087] " nobu
2017-05-19 9:01 ` [ruby-dev:50126] " akr
2017-05-19 9:06 ` [ruby-dev:50127] " shyouhei
2017-05-19 9:08 ` [ruby-dev:50128] " matz
2017-09-14 9:07 ` [ruby-dev:50242] " eregontp
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).