るりまサーチ

最速Rubyリファレンスマニュアル検索!
1012件ヒット [701-800件を表示] (0.019秒)
トップページ > モジュール:Kernel[x] > 種類:変数[x]

ライブラリ

キーワード

検索結果

<< < ... 6 7 8 9 10 ... > >>

Kernel$$NR -> Integer (2.0)

$. の別名

$. の別名

1 e
2 f
3 g
4 h
5 i
# end of a.txt

require "English"

File.foreach(ARGV.at(0)){|line|
# read line
}
p $INPUT_LINE_NUMBER
# end of sample.rb

ruby sample.rb a.txt
#=> 5

Kernel$$OFS -> String | nil (2.0)

$, の別名

$, の別名

require "English"

array = %w|hoge fuga ugo bar foo|
p array.join #=> "hogefugaugobarfoo"
$OUTPUT_FIELD_SEPARATOR = ","
p array.join #=> "hoge,fuga,ugo,bar,foo"

Kernel$$ORS -> String | nil (2.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$$OUTPUT_FIELD_SEPARATOR -> String | nil (2.0)

$, の別名

$, の別名

require "English"

array = %w|hoge fuga ugo bar foo|
p array.join #=> "hogefugaugobarfoo"
$OUTPUT_FIELD_SEPARATOR = ","
p array.join #=> "hoge,fuga,ugo,bar,foo"

Kernel$$OUTPUT_RECORD_SEPARATOR -> String | nil (2.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$$PID -> Integer (2.0)

$$ の別名

$$ の別名

require "English"

p sprintf("something%s", $PID) #=> "something5543" など

Kernel$$POSTMATCH -> String | nil (2.0)

$' の別名

$' の別名

require "English"

str = 'hoge,foo,bar,hee,hoo'

/foo/ =~ str
p $POSTMATCH #=> ",bar,hee,hoo"

Kernel$$PREMATCH -> String | nil (2.0)

$` の別名

$` の別名

require "English"

str = 'hoge,foo,bar,hee,hoo'

/foo/ =~ str
p $PREMATCH #=> "hoge,"

Kernel$$PROCESS_ID -> Integer (2.0)

$$ の別名

$$ の別名

require "English"

p sprintf("something%s", $PID) #=> "something5543" など

Kernel$$PROGRAM_NAME -> String (2.0)

現在実行中の Ruby スクリプトの名前を表す文字列です。

現在実行中の Ruby スクリプトの名前を表す文字列です。

OS と Ruby のバージョンによっては、この変数に代入すると ps(1) の出力が変化します。
この機能はプログラムの現在の状態を表示するのに便利です。

この変数はグローバルスコープです。

絞り込み条件を変える

<< < ... 6 7 8 9 10 ... > >>