るりまサーチ

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

ライブラリ

キーワード

検索結果

<< < ... 5 6 7 8 9 ... > >>

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

$/ の別名

$/ の別名

require "English"

$INPUT_RECORD_SEPARATOR = '|'
array = []
while line = DATA.gets
array << line
end
p array #=> ["ugo|", "ego|", "fogo\n"]

__END__
ugo|ego|fogo

Kernel$$KCODE -> nil (2.0)

この特殊変数は何の影響も持たなくなりました。

...たなくなりました。

値を代入しても無視され、参照すると常に nil です。

>> $KCODE = true
(irb):1: warning: variable $KCODE is no longer effective; ignored
=> true
>> $KCODE
(irb):2: warning: variable $KCODE is no longer effective
=> nil

@see spec/rubycmd...

Kernel$$KCODE -> object (2.0)

通常のグローバル変数です。

通常のグローバル変数です。

Ruby 2.7 以前は特殊変数でしたが、Ruby 3.0 から通常のグローバル変数になりました。
任意のオブジェクトを代入して nil 以外の値に設定できます。

@see spec/rubycmd

Kernel$$LAST_MATCH_INFO -> MatchData | nil (2.0)

$~ の別名

$~ の別名

require "English"

str = "<a href=https://www.ruby-lang.org/en/about/license.txt>license</a>"

if /<a href=(.+?)>/ =~ str
p $LAST_MATCH_INFO[0] #=> "<a href=https://www.ruby-lang.org/en/about/license.txt>"
p $LAST_MATCH_INFO[1] #=> "https://www.ruby-lang.org/en/about/license.t...

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

$+ の別名

$+ の別名

require "English"

r1 = Regexp.compile("<img src=(http:.+?)>")
r2 = Regexp.compile("<a href=(http|ftp).+?>(.+?)</a>")

while line = DATA.gets
[ r1, r2 ].each {|rep|
rep =~ line
p $+
}
end
__END__
<tr> <td><img src=http://localhost/a.jpg></td> <td>ikkou</td>...

絞り込み条件を変える

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

$_ の別名

$_ の別名

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

ruby -rEnglish -ne'p $LAST_READ_LINE' a.txt
#=>
"1 e\n"
"2 f\n"
"3 g\n"
"4 h\n"
"5 i\n"

Kernel$$LDFLAGS -> String (2.0)

拡張ライブラリをリンクするときのリンカのオプション、 ライブラリファイルのディレクトリを指定する文字列です。

...拡張ライブラリをリンクするときのリンカのオプション、
ライブラリファイルのディレクトリを指定する文字列です。

Kernel
#find_library または Kernel#dir_config
の検査が成功すると、$LDFLAGS の値に "-Ldir" を追加します。...

Kernel$$LOADED_FEATURES -> [String] (2.0)

Kernel.#require でロードされたファイル名を含む配列です。

...
Kernel
.#require でロードされたファイル名を含む配列です。

Kernel
.#require で同じファイルを
複数回ロードしないようにするためのロックとして使われます。

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

Kernel$$LOAD_PATH -> [String] (2.0)

Rubyライブラリをロードするときの検索パスです。

...Rubyライブラリをロードするときの検索パスです。

Kernel
.#load や Kernel.#require
がファイルをロードする時に検索するディレクトリのリストを含む配列です。

起動時にはコマンドラインオプション -I で指定したディレクトリ、...

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

$& の別名

$& の別名

require "English"

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

/(foo|bar)/ =~ str
p $MATCH #=> "foo"

絞り込み条件を変える

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
<< < ... 5 6 7 8 9 ... > >>