4件ヒット
[1-4件を表示]
(0.140秒)
検索結果
先頭4件
-
Pathname
# each _ line(*args) {|line| . . . } -> nil (18688.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("testfile", "line1\nline2,\nline3\... -
Pathname
# each _ line(*args) -> Enumerator (18388.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("testfile", "line1\nline2,\nline3\... -
Enumerable
# chunk {|elt| . . . } -> Enumerator (9322.0) -
要素を前から順にブロックで評価し、その結果によって 要素をチャンクに分けた(グループ化した)要素を持つ Enumerator を返します。
要素を前から順にブロックで評価し、その結果によって
要素をチャンクに分けた(グループ化した)要素を持つ
Enumerator を返します。
ブロックの評価値が同じ値が続くものを一つのチャンクとして
取り扱います。すなわち、ブロックの評価値が一つ前と
異なる所でチャンクが区切られます。
返り値の Enumerator は各チャンクのブロック評価値と
各チャンクの要素を持つ配列のペアを各要素とします。
そのため、eachだと以下のようになります。
//emlist[][ruby]{
enum.chunk {|elt| key }.each {|key, ary| do_something ... -
Pathname
# each _ entry {|pathname| . . . } -> nil (370.0) -
Dir.foreach(self.to_s) {|f| yield Pathname.new(f) } と同じです。
Dir.foreach(self.to_s) {|f| yield Pathname.new(f) } と同じです。
//emlist[例][ruby]{
require "pathname"
Pathname("/usr/local").each_entry {|f| p f }
# => #<Pathname:.>
# => #<Pathname:..>
# => #<Pathname:bin>
# => #<Pathname:etc>
# => #<Pathname:include>
# => #<Pathname:lib>
# => #<Pathname:opt>
//}
@...