るりまサーチ (Ruby 2.2.0)

最速Rubyリファレンスマニュアル検索!
5件ヒット [1-5件を表示] (0.155秒)

別のキーワード

  1. _builtin to_a
  2. matrix to_a
  3. to_a
  4. dbm to_a
  5. argf.class to_a

ライブラリ

キーワード

検索結果

Dir#each -> Enumerator (18307.0)

ディレクトリの各エントリを表す文字列を引数として、ブロックを評価します。

...えられなかった場合、各エントリを文字列として保持する
Enumerator
オブジェクトを返します。

@raise IOError 既に自身が close している場合に発生します。

//emlist[例][ruby]{
Dir
.open('.').each{|f|
p f
}
#=> "."
# ".."
# "bar"
# "foo"
//}...

Dir#each {|item| ... } -> self (18307.0)

ディレクトリの各エントリを表す文字列を引数として、ブロックを評価します。

...えられなかった場合、各エントリを文字列として保持する
Enumerator
オブジェクトを返します。

@raise IOError 既に自身が close している場合に発生します。

//emlist[例][ruby]{
Dir
.open('.').each{|f|
p f
}
#=> "."
# ".."
# "bar"
# "foo"
//}...

Dir#path -> String (18307.0)

オープンしているディレクトリのパス名を文字列で返します。

...オープンしているディレクトリのパス名を文字列で返します。

//emlist[例][ruby]{
Dir
.open("..") do |d|
d.path # => ".."
d.to_path # => ".."
end
//}...

Dir#read -> String | nil (18307.0)

ディレクトリストリームから次の要素を読み出して返します。最後の要素 まで読み出していれば nil を返します。

...場合に発生します。

//emlist[例][ruby]{
require 'tmpdir'

Dir
.mktmpdir do |tmpdir|
File.open("#{tmpdir}/test1.txt", "w") { |f| f.puts("test1") }
File.open("#{tmpdir}/test2.txt", "w") { |f| f.puts("test2") }
Dir
.open(tmpdir) do |d|
p d.read # => "."
p d.read # => ".."...

Dir#to_path -> String (18307.0)

オープンしているディレクトリのパス名を文字列で返します。

...オープンしているディレクトリのパス名を文字列で返します。

//emlist[例][ruby]{
Dir
.open("..") do |d|
d.path # => ".."
d.to_path # => ".."
end
//}...

絞り込み条件を変える