るりまサーチ

最速Rubyリファレンスマニュアル検索!
3133件ヒット [1-100件を表示] (0.134秒)
トップページ > クエリ:l[x] > クエリ:>[x] > クエリ:$[x]

別のキーワード

  1. matrix l
  2. kernel $-l
  3. _builtin $-l
  4. lupdecomposition l
  5. l

ライブラリ

クラス

モジュール

キーワード

検索結果

<< 1 2 3 ... > >>

Kernel$$> -> object (15367.0)

標準出力です。

...数 Kernel.#print、Kernel.#puts や
Kernel.#p などのデフォルトの出力先となります。
初期値は Object::STDOUT です。
コマンドラインオプションオプション -i を指定した場合には
読み込み元と同じ名前のファイルを表します。

$
stdout に...
...イレクトしたいときには、
以下のように $stdout に代入すれば十分です。

//emlist[例][ruby]{
# 標準出力の出力先を /tmp/foo に変更
$
stdout = File.open("/tmp/foo", "w")
puts "foo" # 出力する
$
stdout = STDOUT # 元に戻す
//}

自プロセスだけ...
...//emlist[例][ruby]{
STDOUT.reopen("/tmp/foo", "w")
//}

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

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

Kernel$$-l -> bool (12417.0)

コマンドラインオプション -l を指定したとき true に設定されます。 この変数には代入できません。

...コマンドラインオプション -l を指定したとき true に設定されます。
この変数には代入できません。

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

@see spec/rubycmd...

Kernel$$LAST_PAREN_MATCH -> String | nil (12349.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>ikko...
...u</td> <td><a href=http://localhost/link.html>link</a></td> </tr>
#enf of sample.rb

$
ruby sample.rb
"http://localhost/a.jpg"
"link"...

Kernel$$DEFAULT_OUTPUT -> IO (12325.0)

$> の別名

...
$
> の別名

require "English"

dout = $DEFAULT_OUTPUT.dup
$
DEFAULT_OUTPUT.reopen("out.txt", "w")
print "foo"
$
DEFAULT_OUTPUT.close
$
DEFAULT_OUTPUT = dout
p "bar" # => bar
p File.read("out.txt") #=> foo...

Kernel$$LAST_MATCH_INFO -> MatchData | nil (12325.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/lic...
...ense.txt"
p $LAST_MATCH_INFO[2] #=> nil
end...

絞り込み条件を変える

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

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

...検索パスです。

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

起動時にはコマンドラインオプション -I で指定したディレクトリ、
環境変数 RUBYLIB の値、
コンパイ...
...ると foo.sl を検索します。
したがって Ruby で記述されたコードでは常に .so を使うべきです。

なお、ロードパスをコマンドラインから調べるには

$
ruby -e 'puts $:'

とします。

$
LOAD_PATH の特異メソッドとして resolve_feature_path...
...ています。
require を呼んだときに読み込まれるファイルを特定できます。

//emlist[][ruby]{
p $LOAD_PATH.resolve_feature_path('set')
# => [:rb, "/build-all-ruby/2.7.0/lib/ruby/2.7.0/set.rb"]
//}

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

@see spec/rubycmd, spec/...

Kernel$$FIELD_SEPARATOR -> String | nil (12308.0)

$; の別名

...
$
; の別名

require "English"

str = "hoge,fuga,ugo,bar,foo"
p str.split #=> ["hoge,fuga,ugo,bar,foo"]
$
FIELD_SEPARATOR = ","
p str.split #=> ["hoge", "fuga", "ugo", "bar", "foo"]...

Kernel$$INPUT_LINE_NUMBER -> Integer (12308.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$$OUTPUT_FIELD_SEPARATOR -> String | nil (12308.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$$CHILD_STATUS -> Process::Status | nil (12307.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...

絞り込み条件を変える

<< 1 2 3 ... > >>