< :前の番号
^ :番号順リスト
> :次の番号
P :前の記事(スレッド移動)
N :次の記事(スレッド移動)
|<:前のスレッド
>|:次のスレッド
^ :返事先
_:自分への返事
>:同じ返事先を持つ記事(前)
<:同じ返事先を持つ記事(後)
---:分割してスレッド表示、再表示
| :分割して(縦)スレッド表示、再表示
~ :スレッドのフレーム消去
.:インデックス
..:インデックスのインデックス
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/