るりまサーチ

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

別のキーワード

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

ライブラリ

キーワード

検索結果

<< 1 2 > >>

Kernel$$OUTPUT_RECORD_SEPARATOR -> String | nil (3132.0)

$\ の別名

...$\ の別名

require "English"

print
"hoge\nhuga\n"
$OUTPUT_RECORD_SEPARATOR = "\n"
print
"fuge"
print
"ugo"
# end of sample.rb

ruby
sample.rb
hoge
huga
fuge
ugo...

Kernel$$CHILD_STATUS -> Process::Status | nil (126.0)

$? の別名

...$? の別名

require "English"

out = `wget https://www.ruby-lang.org/en/about/license.txt -O - 2>/dev/null`

if $CHILD_STATUS.to_i == 0
print
"wget success\n"
out.split(/\n/).each { |line|
print
f "%s\n", line
}
else
print
"wget failed\n"
end...

Kernel$$> -> object (50.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 (50.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$$1 -> String | nil (38.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$$10 -> String | nil (38.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$$11 -> String | nil (38.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$$2 -> String | nil (38.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$$3 -> String | nil (38.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"
//}...
<< 1 2 > >>