180件ヒット
[1-100件を表示]
(0.073秒)
別のキーワード
検索結果
先頭5件
-
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|
printf "%s\n", line
}
else
print "wget failed\n"
end... -
Kernel
$ $ > -> object (50.0) -
標準出力です。
...標準出力です。
組み込み関数 Kernel.#print、Kernel.#puts や
Kernel.#p などのデフォルトの出力先となります。
初期値は Object::STDOUT です。
コマンドラインオプションオプション -i を指定した場合には
読み込み元と同じ名前のフ......][ruby]{
# 標準出力の出力先を /tmp/foo に変更
$stdout = File.open("/tmp/foo", "w")
puts "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.#print、Kernel.#puts や
Kernel.#p などのデフォルトの出力先となります。
初期値は Object::STDOUT です。
コマンドラインオプションオプション -i を指定した場合には
読み込み元と同じ名前のフ......][ruby]{
# 標準出力の出力先を /tmp/foo に変更
$stdout = File.open("/tmp/foo", "w")
puts "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"
//}...