別のキーワード
種類
- モジュール関数 (347)
- インスタンスメソッド (122)
- 変数 (121)
ライブラリ
キーワード
-
$ ! (11) -
$ . (11) -
$ < (11) -
$ > (11) -
$ DEFAULT _ INPUT (11) -
$ DEFAULT _ OUTPUT (11) -
$ ERROR _ INFO (11) -
$ ERROR _ POSITION (11) -
$ stderr (11) -
$ stdin (11) -
$ stdout (11) - BigDecimal (12)
- Complex (12)
- Float (6)
- Integer (6)
- JSON (11)
- Rational (11)
-
caller
_ locations (22) - desc (11)
- exec (44)
-
file
_ create (11) - fork (22)
- gem (11)
- open (36)
- print (11)
- printf (22)
- putc (11)
- puts (11)
- scanf (12)
- select (11)
- spawn (44)
- system (44)
- test (22)
- timeout (11)
-
try
_ link (22) - xpopen (22)
検索結果
先頭5件
- Kernel
. # Rational(x , y = 1 , exception: true) -> Rational | nil - Kernel
. # Rational(x , y = 1) -> Rational - Kernel
. # caller _ locations(range) -> [Thread :: Backtrace :: Location] | nil - Kernel
. # caller _ locations(start = 1 , length = nil) -> [Thread :: Backtrace :: Location] | nil - Kernel
$ $ ERROR _ POSITION -> [String] | nil
-
Kernel
. # Rational(x , y = 1 , exception: true) -> Rational | nil (6301.0) -
引数を有理数(Rational)に変換した結果を返します。
...を有理数(Rational)に変換した結果を返します。
@param x 変換対象のオブジェクトです。
@param y 変換対象のオブジェクトです。省略した場合は x だけを用いて
Rational オブジェクトを作成します。
@param exception false を指......x/y した Rational オブジェクトを
返します。
//emlist[例][ruby]{
Rational("1/3") # => (1/3)
Rational(1, 3) # => (1/3)
Rational("0.1", "0.3") # => (1/3)
Rational(Complex(1,2), 2) # => ((1/2)+(1/1)*i)
//}
ただし、1.8系とは異なり、Rational オブジェ......また、Kernel.#Integer とは違い "0x10" のような進数を表す接頭
辞を含めた指定は行えません。
//emlist[例][ruby]{
Rational("1/3") # => (1/3)
Rational("0.3") # => (3/10)
Rational('0.3E0') # => (3/10)
Rational('0.1E1/3') # => (1/3)
Rational('1.2/3')... -
Kernel
. # Rational(x , y = 1) -> Rational (6201.0) -
引数を有理数(Rational)に変換した結果を返します。
...引数を有理数(Rational)に変換した結果を返します。
@param x 変換対象のオブジェクトです。
@param y 変換対象のオブジェクトです。省略した場合は x だけを用いて
Rational オブジェクトを作成します。
@raise ArgumentError......x/y した Rational オブジェクトを
返します。
//emlist[例][ruby]{
Rational("1/3") # => (1/3)
Rational(1, 3) # => (1/3)
Rational("0.1", "0.3") # => (1/3)
Rational(Complex(1,2), 2) # => ((1/2)+(1/1)*i)
//}
ただし、1.8系とは異なり、Rational オブジェ......また、Kernel.#Integer とは違い "0x10" のような進数を表す接頭
辞を含めた指定は行えません。
//emlist[例][ruby]{
Rational("1/3") # => (1/3)
Rational("0.3") # => (3/10)
Rational('0.3E0') # => (3/10)
Rational('0.1E1/3') # => (1/3)
Rational('1.2/3')... -
Kernel
. # caller _ locations(range) -> [Thread :: Backtrace :: Location] | nil (6201.0) -
現在のフレームを Thread::Backtrace::Location の配列で返します。引 数で指定した値が範囲外の場合は nil を返します。
...現在のフレームを Thread::Backtrace::Location の配列で返します。引
数で指定した値が範囲外の場合は nil を返します。
@param start 開始フレームの位置を数値で指定します。
@param length 取得するフレームの個数を指定します。
@pa......{
def test1(start, length)
locations = caller_locations(start, length)
p locations
p locations.map(&:lineno)
p locations.map(&:path)
end
def test2(start, length)
test1(start, length)
end
def test3(start, length)
test2(start, length)
end
caller_locations # => []
test3(1, nil)
# => ["/U......(1, 2)
# => ["/Users/user/test.rb:9:in `test2'", "/Users/user/test.rb:13:in `test3'"]
# => [9, 13]
# => ["/Users/user/test.rb", "/Users/user/test.rb"]
test3(2, 1)
# => ["/Users/user/test.rb:13:in `test3'"]
# => [13]
# => ["/Users/user/test.rb"]
//}
@see Thread::Backtrace::Location, Kernel.#caller... -
Kernel
. # caller _ locations(start = 1 , length = nil) -> [Thread :: Backtrace :: Location] | nil (6201.0) -
現在のフレームを Thread::Backtrace::Location の配列で返します。引 数で指定した値が範囲外の場合は nil を返します。
...現在のフレームを Thread::Backtrace::Location の配列で返します。引
数で指定した値が範囲外の場合は nil を返します。
@param start 開始フレームの位置を数値で指定します。
@param length 取得するフレームの個数を指定します。
@pa......{
def test1(start, length)
locations = caller_locations(start, length)
p locations
p locations.map(&:lineno)
p locations.map(&:path)
end
def test2(start, length)
test1(start, length)
end
def test3(start, length)
test2(start, length)
end
caller_locations # => []
test3(1, nil)
# => ["/U......(1, 2)
# => ["/Users/user/test.rb:9:in `test2'", "/Users/user/test.rb:13:in `test3'"]
# => [9, 13]
# => ["/Users/user/test.rb", "/Users/user/test.rb"]
test3(2, 1)
# => ["/Users/user/test.rb:13:in `test3'"]
# => [13]
# => ["/Users/user/test.rb"]
//}
@see Thread::Backtrace::Location, Kernel.#caller... -
Kernel
$ $ ERROR _ POSITION -> [String] | nil (6101.0) -
$@ の別名
...$@ の別名
require "English"
class SomethingError < StandardError; end
begin
raise SomethingError
rescue
p $ERROR_POSITION #=> ["sample.rb:5"]
end... -
Kernel
. # open(name , mode = & # 39;r& # 39; , perm = nil , options = {}) -> StringIO | Tempfile | IO (302.0) -
name が http:// や ftp:// で始まっている文字列なら URI のリソースを 取得した上で StringIO オブジェクトまたは Tempfile オブジェクトとして返します。 返されるオブジェクトは OpenURI::Meta モジュールで extend されています。
...name が http:// や ftp:// で始まっている文字列なら URI のリソースを
取得した上で StringIO オブジェクトまたは Tempfile オブジェクトとして返します。
返されるオブジェクトは OpenURI::Meta モジュールで extend されています。
name......イル名として扱われ、従来の
Kernel.#open(name, *rest) が呼ばれます。
ブロックを与えた場合は上の場合と同様、name が http:// や ftp:// で
始まっている文字列なら URI のリソースを取得した上で StringIO オブジェクト
または Tempfile......を文字列で与えます。Kernel.#open と同じです。
@param perm open(2) の第 3 引数のように、ファイルを生成する場合のファイルのパーミッションを
整数で指定します。Kernel.#open と同じです
@param options ハッシュを与えます......uby2.7以降、open-uriにより拡張されたKernel.openでURLを開くときにwarningが表示されるようになりました。
require 'open-uri'
open("http://www.ruby-lang.org/") {|f|
# ...
}
#=> warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or... -
Kernel
. # spawn(env , program , *args , options={}) -> Integer (185.0) -
引数を外部コマンドとして実行しますが、生成した 子プロセスの終了を待ち合わせません。生成した子プロセスのプロセスIDを返します。
...ラム名になります。
また、第1要素はフルパスで指定しなくても環境変数 PATH から探します。
=== option引数の概要
Hash を options として渡すことで、起動される子プロセスの
* プロセスグループ
* resource limit
* カレントデ......、0(stdin), 1(stdout), 2(stderr) 以外の
ファイルデスクリプタをすべて閉じます。
true がデフォルトです。
=== option引数によるリダイレクトの概要
Hash のキー(子プロセス側)には以下のいずれかが指定できます。
* 単一のファ......列を指定します。
@param options オプションパラメータ Hash
@raise ArgumentError 第一引数が配列かつ要素数が 2 でない場合に発生します。
@raise Errno::EXXX コマンドが実行できなかった場合に発生します。
@see Kernel.#system,Kernel.#exec......。
false がデフォルトです。
: :exception
Kernel.#system のみで指定できます。
これを true に設定すると、nil や false を返す代わりに例外が発生します。
false がデフォルトです。
=== option引数によるリダイレクトの概要
Hash......ー出力, ファイルデスクリプタ2
* 整数 指定した整数が表すファイルデスクリプタ
* IO IO#fileno で表されるファイルデスクリプタ
=== option引数の詳細および例
「:unsetenv_others」を使うと、envで指定したもの以外の環境変数を... -
Kernel
. # open(file , mode _ enc = "r" , perm = 0666) -> IO (155.0) -
file をオープンして、IO(Fileを含む)クラスのインスタンスを返します。
...file をオープンして、IO(Fileを含む)クラスのインスタンスを返します。
ブロックが与えられた場合、指定されたファイルをオープンし、
生成した IO オブジェクトを引数としてブロックを実行します。
ブロックの終了時......が "|-" である時、open は Ruby の子プロセス
を生成し、その子プロセスとの間のパイプ(IOオブジェクト)を返し
ます。(このときの動作は、IO.popen と同じです。
File.open にはパイプラインを生成する機能はありません)。
Perlと異......ョンを整数で指定します。
@raise Errno::EXXX ファイルのオープンに失敗した場合に発生します。
@see File.open,IO.popen,IO.open
=== 第二引数のオープンモード・エンコーディング
文字列("mode" か "mode:ext_enc" か "mode:ext_enc:int_enc" とい... -
Kernel
. # open(file , mode _ enc = "r" , perm = 0666) {|io| . . . } -> object (155.0) -
file をオープンして、IO(Fileを含む)クラスのインスタンスを返します。
...file をオープンして、IO(Fileを含む)クラスのインスタンスを返します。
ブロックが与えられた場合、指定されたファイルをオープンし、
生成した IO オブジェクトを引数としてブロックを実行します。
ブロックの終了時......が "|-" である時、open は Ruby の子プロセス
を生成し、その子プロセスとの間のパイプ(IOオブジェクト)を返し
ます。(このときの動作は、IO.popen と同じです。
File.open にはパイプラインを生成する機能はありません)。
Perlと異......ョンを整数で指定します。
@raise Errno::EXXX ファイルのオープンに失敗した場合に発生します。
@see File.open,IO.popen,IO.open
=== 第二引数のオープンモード・エンコーディング
文字列("mode" か "mode:ext_enc" か "mode:ext_enc:int_enc" とい... -
Kernel
. # select(reads , writes = [] , excepts = [] , timeout = nil) -> [[IO]] | nil (148.0) -
IO.select と同じです。
...
IO.select と同じです。
@param reads IO.select 参照
@param writes IO.select 参照
@param excepts IO.select 参照
@param timeout IO.select 参照
@see IO.select... -
Kernel
# xpopen(command , *mode) -> IO (130.0) -
command を表示してから IO.popen の実行します。
...command を表示してから IO.popen の実行します。
@param command コマンド名を指定します。
@param mode オープンする IO ポートのモードを指定します。mode の詳細は Kernel.#open 参照して下さい。
@see IO.popen...