るりまサーチ

最速Rubyリファレンスマニュアル検索!
180件ヒット [101-180件を表示] (0.069秒)
トップページ > クエリ:Ruby[x] > モジュール:Kernel[x] > クエリ:p[x] > クエリ:print[x] > 種類:変数[x]

別のキーワード

  1. rbconfig ruby
  2. fiddle ruby_free
  3. fiddle build_ruby_platform
  4. rake ruby
  5. rubygems/defaults ruby_engine

ライブラリ

キーワード

検索結果

<< < 1 2 >>

Kernel$$5 -> String | nil (32.0)

最後に成功したパターンマッチで n 番目の括弧にマッチした値が格納されます。 該当する括弧がなければ nil が入っています。(覚え方: \数字 のようなもの)

...xp.last_match(1),
Regexp.last_match(2), ... と同じ。

これらの変数はローカルスコープかつスレッドローカル、読み取り専用です。

//emlist[例][ruby]{
str = '<p><a href="http://example.com">example.com</a></p>'
if %r[<a href="(.*?)">(.*?)</a>] =~ str
print
$1
p
...
...rint $2
end
#=> "http://example.com"
#=> "example.com"
//}...

Kernel$$6 -> String | nil (32.0)

最後に成功したパターンマッチで n 番目の括弧にマッチした値が格納されます。 該当する括弧がなければ nil が入っています。(覚え方: \数字 のようなもの)

...xp.last_match(1),
Regexp.last_match(2), ... と同じ。

これらの変数はローカルスコープかつスレッドローカル、読み取り専用です。

//emlist[例][ruby]{
str = '<p><a href="http://example.com">example.com</a></p>'
if %r[<a href="(.*?)">(.*?)</a>] =~ str
print
$1
p
...
...rint $2
end
#=> "http://example.com"
#=> "example.com"
//}...

Kernel$$7 -> String | nil (32.0)

最後に成功したパターンマッチで n 番目の括弧にマッチした値が格納されます。 該当する括弧がなければ nil が入っています。(覚え方: \数字 のようなもの)

...xp.last_match(1),
Regexp.last_match(2), ... と同じ。

これらの変数はローカルスコープかつスレッドローカル、読み取り専用です。

//emlist[例][ruby]{
str = '<p><a href="http://example.com">example.com</a></p>'
if %r[<a href="(.*?)">(.*?)</a>] =~ str
print
$1
p
...
...rint $2
end
#=> "http://example.com"
#=> "example.com"
//}...

Kernel$$8 -> String | nil (32.0)

最後に成功したパターンマッチで n 番目の括弧にマッチした値が格納されます。 該当する括弧がなければ nil が入っています。(覚え方: \数字 のようなもの)

...xp.last_match(1),
Regexp.last_match(2), ... と同じ。

これらの変数はローカルスコープかつスレッドローカル、読み取り専用です。

//emlist[例][ruby]{
str = '<p><a href="http://example.com">example.com</a></p>'
if %r[<a href="(.*?)">(.*?)</a>] =~ str
print
$1
p
...
...rint $2
end
#=> "http://example.com"
#=> "example.com"
//}...

Kernel$$9 -> String | nil (32.0)

最後に成功したパターンマッチで n 番目の括弧にマッチした値が格納されます。 該当する括弧がなければ nil が入っています。(覚え方: \数字 のようなもの)

...xp.last_match(1),
Regexp.last_match(2), ... と同じ。

これらの変数はローカルスコープかつスレッドローカル、読み取り専用です。

//emlist[例][ruby]{
str = '<p><a href="http://example.com">example.com</a></p>'
if %r[<a href="(.*?)">(.*?)</a>] =~ str
print
$1
p
...
...rint $2
end
#=> "http://example.com"
#=> "example.com"
//}...

絞り込み条件を変える

Kernel$$> -> object (32.0)

標準出力です。

...標準出力です。

組み込み関数 Kernel.#printKernel.#puts や
Kernel
.#p などのデフォルトの出力先となります。
初期値は Object::STDOUT です。
コマンドラインオプションオプション -i を指定した場合には
読み込み元と同じ名前のフ...
...][ruby]{
# 標準出力の出力先を /tmp/foo に変更
$stdout = File.open("/tmp/foo", "w")
p
uts "foo" # 出力する
$stdout = STDOUT # 元に戻す
//}

自プロセスだけでなく、子プロセスの標準出力もリダイレクトしたいときは
以下のように IO#reopen...
...][ruby]{
STDOUT.reopen("/tmp/foo", "w")
//}

また、リダイレクトしたあと
出力先をまた元に戻したい場合は以下のようにします。

//emlist[例][ruby]{
stdout_old = $stdout.dup # 元の $stdout を保存する
$stdout.reopen("/tmp/foo") # $stdout を /tmp/f...

Kernel$$stdout -> object (32.0)

標準出力です。

...標準出力です。

組み込み関数 Kernel.#printKernel.#puts や
Kernel
.#p などのデフォルトの出力先となります。
初期値は Object::STDOUT です。
コマンドラインオプションオプション -i を指定した場合には
読み込み元と同じ名前のフ...
...][ruby]{
# 標準出力の出力先を /tmp/foo に変更
$stdout = File.open("/tmp/foo", "w")
p
uts "foo" # 出力する
$stdout = STDOUT # 元に戻す
//}

自プロセスだけでなく、子プロセスの標準出力もリダイレクトしたいときは
以下のように IO#reopen...
...][ruby]{
STDOUT.reopen("/tmp/foo", "w")
//}

また、リダイレクトしたあと
出力先をまた元に戻したい場合は以下のようにします。

//emlist[例][ruby]{
stdout_old = $stdout.dup # 元の $stdout を保存する
$stdout.reopen("/tmp/foo") # $stdout を /tmp/f...
<< < 1 2 >>