るりまサーチ

最速Rubyリファレンスマニュアル検索!
63件ヒット [1-63件を表示] (0.033秒)
トップページ > クエリ:self[x] > クエリ:foreach[x]

別のキーワード

  1. object yield_self
  2. _builtin yield_self
  3. _builtin self
  4. tracepoint self
  5. codeobject document_self

ライブラリ

クラス

モジュール

キーワード

検索結果

Syslog.#open!(ident=$0, options=Syslog::LOG_PID|Syslog::LOG_CONS, facility=Syslog::LOG_USER) { |syslog| ... } -> self (108.0)

開いていた syslog を最初にクローズする点を除いてSyslog.#open と同じです。

...log.open!("syslogtest2")
Syslog.log(Syslog::LOG_WARNING, "the sky is falling in %d seconds!", 200)
rescue RuntimeError => err
# RuntimeError は発生しない。
puts err
end
File.foreach('/var/log/system.log'){|line|
print line if line =~ /the sky is/
}

@see Syslog.#open...

Syslog.#reopen(ident=$0, options=Syslog::LOG_PID|Syslog::LOG_CONS, facility=Syslog::LOG_USER) { |syslog| ... } -> self (108.0)

開いていた syslog を最初にクローズする点を除いてSyslog.#open と同じです。

...log.open!("syslogtest2")
Syslog.log(Syslog::LOG_WARNING, "the sky is falling in %d seconds!", 200)
rescue RuntimeError => err
# RuntimeError は発生しない。
puts err
end
File.foreach('/var/log/system.log'){|line|
print line if line =~ /the sky is/
}

@see Syslog.#open...

Pathname#each_line(*args) -> Enumerator (44.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...
...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_line(*args) {|line| ... } -> nil (44.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...
...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_entry -> Enumerator (38.0)

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

...Dir.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>
# => #<Pathna...
...me:etc>
# => #<Pathname:include>
# => #<Pathname:lib>
# => #<Pathname:opt>
//}

@see Dir.foreach...

絞り込み条件を変える

Pathname#each_entry {|pathname| ... } -> nil (38.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>
# => #<Pathna...
...me:opt>
//}

@see Dir.foreach...
...Dir.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>
# => #<Pathna...
...me:etc>
# => #<Pathname:include>
# => #<Pathname:lib>
# => #<Pathname:opt>
//}

@see Dir.foreach...

NEWS for Ruby 2.6.0 (12.0)

NEWS for Ruby 2.6.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

...ァイルオープンを表すモード文字 'x' が追加されました。 11258

* Kernel
* 別名
* Object#then が Object#yield_self の別名として追加されました。 14594
* 新規オプション
* Kernel.#Complex, Kernel.#Float, Kernel.#Integer,
Kernel....
...推奨になる予定で、
今は警告が出ます。 14643

* File
* File.read, File.binread, File.write, File.binwrite,
File.foreach, File.readlines はパスがパイプ文字 '|' で始まっていても
外部コマンドを実行しなくなりました。 14245

*...