6件ヒット
[1-6件を表示]
(0.090秒)
クラス
- Pathname (6)
キーワード
-
each
_ child (2) -
each
_ entry (1) -
each
_ filename (1) -
each
_ line (2)
検索結果
先頭5件
-
Pathname
# each _ child(with _ directory = true) -> Enumerator (55297.0) -
self.children(with_directory).each と同じです。
...ruby]{
require "pathname"
Pathname("/usr/local").each_child {|f| p f }
# => #<Pathname:/usr/local/bin>
# => #<Pathname:/usr/local/etc>
# => #<Pathname:/usr/local/include>
# => #<Pathname:/usr/local/lib>
# => #<Pathname:/usr/local/opt>
# => #<Pathname:/usr/local/sbin>
# => #<Pathname:/usr/local/shar......e>
# => #<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 _ child(with _ directory = true) {|pathname| . . . } -> [Pathname] (55297.0) -
self.children(with_directory).each と同じです。
...ruby]{
require "pathname"
Pathname("/usr/local").each_child {|f| p f }
# => #<Pathname:/usr/local/bin>
# => #<Pathname:/usr/local/etc>
# => #<Pathname:/usr/local/include>
# => #<Pathname:/usr/local/lib>
# => #<Pathname:/usr/local/opt>
# => #<Pathname:/usr/local/sbin>
# => #<Pathname:/usr/local/shar......e>
# => #<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 _ line(*args) {|line| . . . } -> nil (55285.0) -
IO.foreach(self.to_s, *args, &block) と同じです。
...t[例][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\n")
Pathname("testfile").each_line......uire "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("tes... -
Pathname
# each _ filename {|v| . . . } -> nil (55228.0) -
self のパス名要素毎にブロックを実行します。
...self のパス名要素毎にブロックを実行します。
//emlist[例][ruby]{
require 'pathname'
Pathname.new("/foo/../bar").each_filename {|v| p v}
# => "foo"
# ".."
# "bar"
//}... -
Pathname
# each _ line(*args) -> Enumerator (54985.0) -
IO.foreach(self.to_s, *args, &block) と同じです。
...t[例][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\n")
Pathname("testfile").each_line......uire "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("tes... -
Pathname
# each _ entry {|pathname| . . . } -> nil (36931.0) -
Dir.foreach(self.to_s) {|f| yield Pathname.new(f) } と同じです。
...yield Pathname.new(f) } と同じです。
ブロックを省略した場合は Enumerator を返します。
//emlist[例][ruby]{
require "pathname"
Pathname("/usr/local").each_entry {|f| p f }
# => #<Pathname:.>
# => #<Pathname:..>
# => #<Pathname:bin>
# => #<Pathname:etc>
# => #<Pathname:incl......ude>
# => #<Pathname:lib>
# => #<Pathname:opt>
//}
@see Dir.foreach...