るりまサーチ

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

別のキーワード

  1. kernel spawn
  2. kernel system
  3. kernel exec
  4. kernel open
  5. kernel raise

ライブラリ

クラス

モジュール

検索結果

<< 1 2 3 > >>

Kernel.#abort -> () (21024.0)

Ruby プログラムをエラーメッセージ付きで終了します。終了ステータスは 1 固定です。

...Ruby プログラムをエラーメッセージ付きで終了します。終了ステータスは 1 固定です。

このメソッドと Kernel.#exit との違いは、プログラムの終了ステー
タスが 1 (正確にはCレベルの定数 EXIT_FAILURE の値)固定であることと、...
...#(標準出力)
#=> start
# start1...
# end1 with #<SystemExit: error1>
# start2...
# end2...
#終了ステータス:1
#(標準エラー出力)
#=> error1
# Traceback (most recent call last):
# sample.rb:11:in `<main>': RuntimeError (RuntimeError)
//}

@see Kernel.#exit,Kernel.#exit!...

Kernel.#abort(message) -> () (21024.0)

Ruby プログラムをエラーメッセージ付きで終了します。終了ステータスは 1 固定です。

...Ruby プログラムをエラーメッセージ付きで終了します。終了ステータスは 1 固定です。

このメソッドと Kernel.#exit との違いは、プログラムの終了ステー
タスが 1 (正確にはCレベルの定数 EXIT_FAILURE の値)固定であることと、...
...#(標準出力)
#=> start
# start1...
# end1 with #<SystemExit: error1>
# start2...
# end2...
#終了ステータス:1
#(標準エラー出力)
#=> error1
# Traceback (most recent call last):
# sample.rb:11:in `<main>': RuntimeError (RuntimeError)
//}

@see Kernel.#exit,Kernel.#exit!...

Kernel$$ARGV -> [String] (21012.0)

$* の別名

...$* の別名

require "English"
p $ARGV
# end of sample.rb

ruby sample.rb 31 /home/hoge/fuga.txt
#=> ["31", "/home/hoge/fuga.txt"]...

Kernel$$DEFAULT_INPUT -> IO (21012.0)

$< の別名

...$< の別名

require "English"
while line = $DEFAULT_INPUT.gets
p line
end
# end of sample.rb

ruby sample.rb < /etc/passwd
# => "hoge:x:500:501::/home/hoge:/bin/bash\n"
......

Kernel$$INPUT_LINE_NUMBER -> Integer (21012.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$$LAST_PAREN_MATCH -> String | nil (21012.0)

$+ の別名

...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> <td><a href=http://localhost/link.html>link</a></td> </tr>
#enf of sample.rb

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

Kernel$$NR -> Integer (21012.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$$ORS -> String | nil (21012.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_RECORD_SEPARATOR -> String | nil (21012.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$$ERROR_INFO -> Exception | nil (21006.0)

$! の別名

...$! の別名

require "English"
class SomethingError < StandardError; end

begin
raise SomethingError
rescue
p $ERROR_INFO.backtrace #=> ["sample.rb:5"]
p $ERROR_INFO.to_s #=> "SomethingError"
end...

絞り込み条件を変える

Kernel$$ERROR_POSITION -> [String] | nil (21006.0)

$@ の別名

...$@ の別名

require "English"
class SomethingError < StandardError; end

begin
raise SomethingError
rescue
p $ERROR_POSITION #=> ["sample.rb:5"]
end...
<< 1 2 3 > >>