るりまサーチ

最速Rubyリファレンスマニュアル検索!
48件ヒット [1-48件を表示] (0.023秒)
トップページ > クエリ:enumerator[x] > クエリ:each[x] > ライブラリ:pathname[x]

別のキーワード

  1. each enumerator
  2. enumerator with_index
  3. enumerator with_object
  4. enumerator new

クラス

キーワード

検索結果

Pathname#each_line(*args) -> Enumerator (6235.0)

IO.foreach(self.to_s, *args, &block) と同じです。

...IO.foreach(self.to_s, *args, &block) と同じです。

//emlist[例][ruby]{
require "pathname"

IO.write("testfile", "line1\nline2,\nline3\n")
Pathname
("testfile").each_line
# => #<Enumerator: IO:foreach("testfile")>
//}

//emlist[例 ブロックを指定][ruby]{
require "pathname"

IO.write("tes...
...tfile", "line1\nline2,\nline3\n")
Pathname
("testfile").each_line {|f| p f }

# => "line1\n"
# => "line2,\n"
# => "line3\n"
//}

//emlist[例 limit を指定][ruby]{
require "pathname"

IO.write("testfile", "line1\nline2,\nline3\n")
Pathname
("testfile").each_line(4) {|f| p f }

# => "line"
# => "1\n"...
...# => "line"
# => "2,\n"
# => "line"
# => "3\n"
//}

//emlist[例 sep を指定][ruby]{
require "pathname"

IO.write("testfile", "line1\nline2,\nline3\n")
Pathname
("testfile").each_line(",") {|f| p f }

# => "line1\nline2,"
# => "\nline3\n"
//}

@see IO.foreach...

Pathname#each_child(with_directory = true) -> Enumerator (6233.0)

self.children(with_directory).each と同じです。

...with_directory).each と同じです。

@param with_directory 偽を指定するとファイル名のみ返します。デフォルトは真です。

//emlist[例][ruby]{
require "pathname"

Pathname
("/usr/local").each_child {|f| p f }
# => #<Pathname:/usr/local/bin>
# => #<Pathname:/usr/local/etc...
...=> #<Pathname:/usr/local/lib>
# => #<Pathname:/usr/local/opt>
# => #<Pathname:/usr/local/sbin>
# => #<Pathname:/usr/local/share>
# => #<Pathname:/usr/local/var>

Pathname
("/usr/local").each_child(false) {|f| p f }
# => #<Pathname:bin>
# => #<Pathname:etc>
# => #<Pathname:include>
# => #<Pathname:lib...
...>
# => #<Pathname:opt>
# => #<Pathname:sbin>
# => #<Pathname:share>
# => #<Pathname:var>
//}

@see Pathname#children...

Pathname#each_entry -> Enumerator (6217.0)

Dir.foreach(self.to_s) {|f| yield Pathname.new(f) } と同じです。

...foreach(self.to_s) {|f| yield Pathname.new(f) } と同じです。

ブロックを省略した場合は Enumerator を返します。

//emlist[例][ruby]{
require "pathname"

Pathname
("/usr/local").each_entry {|f| p f }

# => #<Pathname:.>
# => #<Pathname:..>
# => #<Pathname:bin>
# => #<Pathname:e...
...tc>
# => #<Pathname:include>
# => #<Pathname:lib>
# => #<Pathname:opt>
//}

@see Dir.foreach...

Pathname#each_line(*args) {|line| ... } -> nil (6135.0)

IO.foreach(self.to_s, *args, &block) と同じです。

...IO.foreach(self.to_s, *args, &block) と同じです。

//emlist[例][ruby]{
require "pathname"

IO.write("testfile", "line1\nline2,\nline3\n")
Pathname
("testfile").each_line
# => #<Enumerator: IO:foreach("testfile")>
//}

//emlist[例 ブロックを指定][ruby]{
require "pathname"

IO.write("tes...
...tfile", "line1\nline2,\nline3\n")
Pathname
("testfile").each_line {|f| p f }

# => "line1\n"
# => "line2,\n"
# => "line3\n"
//}

//emlist[例 limit を指定][ruby]{
require "pathname"

IO.write("testfile", "line1\nline2,\nline3\n")
Pathname
("testfile").each_line(4) {|f| p f }

# => "line"
# => "1\n"...
...# => "line"
# => "2,\n"
# => "line"
# => "3\n"
//}

//emlist[例 sep を指定][ruby]{
require "pathname"

IO.write("testfile", "line1\nline2,\nline3\n")
Pathname
("testfile").each_line(",") {|f| p f }

# => "line1\nline2,"
# => "\nline3\n"
//}

@see IO.foreach...

Pathname#each_child(with_directory = true) {|pathname| ...} -> [Pathname] (6133.0)

self.children(with_directory).each と同じです。

...with_directory).each と同じです。

@param with_directory 偽を指定するとファイル名のみ返します。デフォルトは真です。

//emlist[例][ruby]{
require "pathname"

Pathname
("/usr/local").each_child {|f| p f }
# => #<Pathname:/usr/local/bin>
# => #<Pathname:/usr/local/etc...
...=> #<Pathname:/usr/local/lib>
# => #<Pathname:/usr/local/opt>
# => #<Pathname:/usr/local/sbin>
# => #<Pathname:/usr/local/share>
# => #<Pathname:/usr/local/var>

Pathname
("/usr/local").each_child(false) {|f| p f }
# => #<Pathname:bin>
# => #<Pathname:etc>
# => #<Pathname:include>
# => #<Pathname:lib...
...>
# => #<Pathname:opt>
# => #<Pathname:sbin>
# => #<Pathname:share>
# => #<Pathname:var>
//}

@see Pathname#children...

絞り込み条件を変える

Pathname#each_entry {|pathname| ... } -> nil (6117.0)

Dir.foreach(self.to_s) {|f| yield Pathname.new(f) } と同じです。

...foreach(self.to_s) {|f| yield Pathname.new(f) } と同じです。

ブロックを省略した場合は Enumerator を返します。

//emlist[例][ruby]{
require "pathname"

Pathname
("/usr/local").each_entry {|f| p f }

# => #<Pathname:.>
# => #<Pathname:..>
# => #<Pathname:bin>
# => #<Pathname:e...
...tc>
# => #<Pathname:include>
# => #<Pathname:lib>
# => #<Pathname:opt>
//}

@see Dir.foreach...