るりまサーチ (Ruby 2.7.0)

最速Rubyリファレンスマニュアル検索!
28件ヒット [1-28件を表示] (0.087秒)
トップページ > クエリ:i[x] > クエリ:NS[x] > モジュール:Kernel[x] > バージョン:2.7.0[x]

別のキーワード

  1. _builtin to_i
  2. fiddle to_i
  3. matrix elements_to_i
  4. csv to_i
  5. matrix i

ライブラリ

キーワード

検索結果

Kernel.#caller_locations(range) -> [Thread::Backtrace::Location] | nil (36904.0)

現在のフレームを Thread::Backtrace::Location の配列で返します。引 数で指定した値が範囲外の場合は nil を返します。

...(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 (36904.0)

現在のフレームを Thread::Backtrace::Location の配列で返します。引 数で指定した値が範囲外の場合は nil を返します。

...(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#install -> () (36604.0)

ファイルをコピーし、その属性を設定します。

ファイルをコピーし、その属性を設定します。


ruby -run -e install -- [OPTION] SOURCE DEST

-p ファイルのアクセス時刻と修正時刻を保持します。
-m chmod と同じようにファイルのパーミッションを設定します。
-v 詳細表示

@see install(1)

Kernel#install_files(mfile, ifiles, map = nil, srcprefix = nil) -> [] (36604.0)

このメソッドは create_makefile, install_rb が使用します。 内部用のメソッドです。

このメソッドは create_makefile, install_rb が使用します。
内部用のメソッドです。

@param mfile Makefile を表す File のインスタンスです。

@param ifiles インストールするファイルのリストを指定します。

@param map ???

@param srcprefix ソースディレクトリを指定します。

Kernel#install_rb(mfile, dest, srcdir = nil) -> Array (36604.0)

このメソッドは create_makefile が使用します。 内部用のメソッドです。

このメソッドは create_makefile が使用します。
内部用のメソッドです。

ディレクトリ srcdir/lib 配下の Ruby スクリプト (*.rb ファイル)
を dest にインストールするための Makefile 規則を mfile に出力します。

srcdir/lib のディレクトリ構造はそのまま dest 配下に反映されます。

@param mfile Makefile を表す File のインスタンスです。

@param dest インストールする先のディレクトリを指定します。

@param srcdir ソースディレクトリを指定します。

絞り込み条件を変える

Kernel#check_signedness(type, headers = nil, opts = nil) -> "signed" | "unsigned" | nil (19204.0)

Returns the signedness of the given +type+. You may optionally specify additional +headers+ to search in for the +type+. If the +type+ is found and is a numeric type, a macro is passed as a preprocessor constant to the compiler using the +type+ name, in uppercase, prepended with 'SIGNEDNESS_OF_', followed by the +type+ name, followed by '=X' where 'X' is positive integer if the +type+ is unsigned, or negative integer if the +type+ is signed. For example, if size_t is defined as unsigned, then check_signedness('size_t') would returned +1 and the SIGNEDNESS_OF_SIZE_T=+1 preprocessor macro would be passed to the compiler, and SIGNEDNESS_OF_INT=-1 if check_signedness('int') is done.

Returns the signedness of the given +type+. You may optionally
specify additional +headers+ to search in for the +type+.

If the +type+ is found and is a numeric type, a macro is passed as a
preprocessor constant to the compiler using the +type+ name, in
uppercase, prepended with 'SIGNEDNESS...

Kernel#check_signedness(type, headers = nil, opts = nil) { ... } -> "signed" | "unsigned" | nil (19204.0)

Returns the signedness of the given +type+. You may optionally specify additional +headers+ to search in for the +type+. If the +type+ is found and is a numeric type, a macro is passed as a preprocessor constant to the compiler using the +type+ name, in uppercase, prepended with 'SIGNEDNESS_OF_', followed by the +type+ name, followed by '=X' where 'X' is positive integer if the +type+ is unsigned, or negative integer if the +type+ is signed. For example, if size_t is defined as unsigned, then check_signedness('size_t') would returned +1 and the SIGNEDNESS_OF_SIZE_T=+1 preprocessor macro would be passed to the compiler, and SIGNEDNESS_OF_INT=-1 if check_signedness('int') is done.

Returns the signedness of the given +type+. You may optionally
specify additional +headers+ to search in for the +type+.

If the +type+ is found and is a numeric type, a macro is passed as a
preprocessor constant to the compiler using the +type+ name, in
uppercase, prepended with 'SIGNEDNESS...

Kernel#try_constant(const, headers = nil, opt = "") -> Integer | nil (19204.0)

定数 const がシステムに存在するかどうか検査します。 Kernel#have_const を使ってください。

...定数 const がシステムに存在するかどうか検査します。
Kernel
#have_const を使ってください。

@param const C 言語の定数名を指定します。

@param headers 追加のヘッダファイルを指定します。

@param opt コンパイラに渡すオプションを...

Kernel#try_constant(const, headers = nil, opt = "") { ... } -> Integer | nil (19204.0)

定数 const がシステムに存在するかどうか検査します。 Kernel#have_const を使ってください。

...定数 const がシステムに存在するかどうか検査します。
Kernel
#have_const を使ってください。

@param const C 言語の定数名を指定します。

@param headers 追加のヘッダファイルを指定します。

@param opt コンパイラに渡すオプションを...

Kernel#try_link(src, opt = "", *options) -> bool (18604.0)

C プログラムのソースコード src をコンパイル、リンクします。

C プログラムのソースコード src をコンパイル、リンクします。

このメソッドは $CFLAGS と $LDFLAGS の値もコンパイラまたはリ
ンカに渡します。

問題なくリンクできたら true を返します。
コンパイルとリンクに失敗したら false を返します。

@param src C プログラムのソースコードを指定します。

@param opt リンカにコマンド引数として渡す値を指定します。

例:

require 'mkmf'
if try_link("int main() { sin(0.0); }", '-lm')
$stderr.puts "si...

絞り込み条件を変える

Kernel#try_link(src, opt = "", *options) { ... } -> bool (18604.0)

C プログラムのソースコード src をコンパイル、リンクします。

C プログラムのソースコード src をコンパイル、リンクします。

このメソッドは $CFLAGS と $LDFLAGS の値もコンパイラまたはリ
ンカに渡します。

問題なくリンクできたら true を返します。
コンパイルとリンクに失敗したら false を返します。

@param src C プログラムのソースコードを指定します。

@param opt リンカにコマンド引数として渡す値を指定します。

例:

require 'mkmf'
if try_link("int main() { sin(0.0); }", '-lm')
$stderr.puts "si...

Kernel.#open(name, mode = 'r', perm = nil, options = {}) -> StringIO | Tempfile | IO (904.0)

name が http:// や ftp:// で始まっている文字列なら URI のリソースを 取得した上で StringIO オブジェクトまたは Tempfile オブジェクトとして返します。 返されるオブジェクトは OpenURI::Meta モジュールで extend されています。

...ock) のように name の open メソッドが呼ばれます。

これ以外の場合は、name はファイル名として扱われ、従来の
Kernel
.#open(name, *rest) が呼ばれます。

ブロックを与えた場合は上の場合と同様、name が http:// や ftp:// で
始まって...
...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...
...ram mode モードを文字列で与えます。Kernel.#open と同じです。

@param perm open(2) の第 3 引数のように、ファイルを生成する場合のファイルのパーミッションを
整数で指定します。Kernel.#open と同じです

@param options ハッシ...

Kernel#JSON(object, options = {}) -> object (604.0)

第一引数に与えられたオブジェクトの種類によって Ruby のオブジェクトか JSON 形式の文字列を返します。

第一引数に与えられたオブジェクトの種類によって Ruby のオブジェクトか JSON 形式の文字列を返します。

第一引数に文字列のようなオブジェクトを指定した場合は、それを JSON.#parse を用いてパースした結果を返します。
そうでないオブジェクトを指定した場合は、それを JSON.#generate を用いて変換した結果を返します。

@param object 任意のオブジェクトを指定します。

@param options JSON.#parse, JSON.#generate に渡すオプションを指定します。

//emlist[例][ruby]{
require "json...

Kernel.#autoload(const_name, feature) -> nil (604.0)

定数 const_name を最初に参照した時に feature を Kernel.#require するように設定します。

...定数 const_name を最初に参照した時に feature を
Kernel
.#require するように設定します。

const_name には、 "::" 演算子を含めることはできません。
ネストした定数を指定する方法は Module#autoload を参照してください。

const_name が aut...
...対象を指定します。
@raise LoadError featureのロードに失敗すると発生します。

//emlist[][ruby]{
# ------- /tmp/foo.rb ---------
class Bar
end
# ----- end of /tmp/foo.rb ----

autoload :Bar, '/tmp/foo'
p Bar #=> Bar
//}

@see Kernel.#autoload?,Module#autoload,Kernel.#require...

Kernel.#autoload?(const_name) -> String | nil (604.0)

const_name が Kernel.#autoload 設定されているか調べます。

...const_name が Kernel.#autoload 設定されているか調べます。

autoload 設定されていて、autoload 定数がまだ定義されてない(ロードされていない)
ときにそのパス名を返します。

autoload 設定されていないか、ロード済みなら nil を返し...
...lass Foo
class Bar
end
end
# ----- end of /tmp/foo.rb ----

class Foo
end
p Foo.autoload?(:Bar) #=> nil
Foo.autoload :Bar, '/tmp/foo'
p Foo.autoload?(:Bar) #=> "/tmp/foo"
p Foo::Bar #=> Foo::Bar
p Foo.autoload?(:Bar) #=> nil
//}

@see Kernel.#autoload...

絞り込み条件を変える

Kernel.#exec(command, options={}) -> () (604.0)

引数で指定されたコマンドを実行します。

引数で指定されたコマンドを実行します。

プロセスの実行コードはそのコマンド(あるいは shell)になるので、
起動に成功した場合、このメソッドからは戻りません。

=== 引数の解釈

この形式では command が shell のメタ文字
//emlist{
* ? {} [] <> () ~ & | \ $ ; ' ` " \n
//}
を含む場合、shell 経由で実行されます。
そうでなければインタプリタから直接実行されます。

@param command コマンドを文字列で指定します。
@param env 更新する環境変数を表す Hash
@param options...

Kernel.#exec(env, command, options={}) -> () (604.0)

引数で指定されたコマンドを実行します。

引数で指定されたコマンドを実行します。

プロセスの実行コードはそのコマンド(あるいは shell)になるので、
起動に成功した場合、このメソッドからは戻りません。

=== 引数の解釈

この形式では command が shell のメタ文字
//emlist{
* ? {} [] <> () ~ & | \ $ ; ' ` " \n
//}
を含む場合、shell 経由で実行されます。
そうでなければインタプリタから直接実行されます。

@param command コマンドを文字列で指定します。
@param env 更新する環境変数を表す Hash
@param options...

Kernel.#exec(env, program, *args, options={}) -> () (604.0)

引数で指定されたコマンドを実行します。

...イルデスクリプタなど)引き継ぎます。
Hash を options として渡すことで、この挙動を変更できます。
詳しくは Kernel.#spawn を参照してください。

=== 引数の解釈

この形式で呼び出した場合、空白や shell のメタキャラクタも
...
...替えて以下を実行
$ ps aux|grep sleep
xxxx 32754 0.0 0.0 2580 468 pts/3 S+ 22:01 0:00 mysleep 600
xxxx 32761 0.0 0.0 2824 792 pts/6 S+ 22:01 0:00 grep sleep

@see Kernel.#system,Kernel.#`,Kernel.#spawn,Kernel.#fork,IO.popen,IO.pipe,Kernel.#open,exec(3)...

Kernel.#exec(program, *args, options={}) -> () (604.0)

引数で指定されたコマンドを実行します。

...イルデスクリプタなど)引き継ぎます。
Hash を options として渡すことで、この挙動を変更できます。
詳しくは Kernel.#spawn を参照してください。

=== 引数の解釈

この形式で呼び出した場合、空白や shell のメタキャラクタも
...
...替えて以下を実行
$ ps aux|grep sleep
xxxx 32754 0.0 0.0 2580 468 pts/3 S+ 22:01 0:00 mysleep 600
xxxx 32761 0.0 0.0 2824 792 pts/6 S+ 22:01 0:00 grep sleep

@see Kernel.#system,Kernel.#`,Kernel.#spawn,Kernel.#fork,IO.popen,IO.pipe,Kernel.#open,exec(3)...

Kernel.#open(name, mode = &#39;r&#39;, perm = nil, options = {}) {|ouri| ...} -> object (604.0)

name が http:// や ftp:// で始まっている文字列なら URI のリソースを 取得した上で StringIO オブジェクトまたは Tempfile オブジェクトとして返します。 返されるオブジェクトは OpenURI::Meta モジュールで extend されています。

...ock) のように name の open メソッドが呼ばれます。

これ以外の場合は、name はファイル名として扱われ、従来の
Kernel
.#open(name, *rest) が呼ばれます。

ブロックを与えた場合は上の場合と同様、name が http:// や ftp:// で
始まって...
...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...
...ram mode モードを文字列で与えます。Kernel.#open と同じです。

@param perm open(2) の第 3 引数のように、ファイルを生成する場合のファイルのパーミッションを
整数で指定します。Kernel.#open と同じです

@param options ハッシ...

絞り込み条件を変える

Kernel.#spawn(command, options={}) -> Integer (604.0)

引数を外部コマンドとして実行しますが、生成した 子プロセスの終了を待ち合わせません。生成した子プロセスのプロセスIDを返します。

...表す Hash
@param options オプションパラメータ Hash
@raise Errno::EXXX 起動に失敗し、ruby インタプリタに制御が戻った場合に発生します。

@raise Errno::EXXX コマンドが実行できなかった場合に発生します。


@see Kernel.#system,Kernel.#exec...

Kernel.#spawn(env, command, options={}) -> Integer (604.0)

引数を外部コマンドとして実行しますが、生成した 子プロセスの終了を待ち合わせません。生成した子プロセスのプロセスIDを返します。

...表す Hash
@param options オプションパラメータ Hash
@raise Errno::EXXX 起動に失敗し、ruby インタプリタに制御が戻った場合に発生します。

@raise Errno::EXXX コマンドが実行できなかった場合に発生します。


@see Kernel.#system,Kernel.#exec...

Kernel.#spawn(env, program, *args, options={}) -> Integer (604.0)

引数を外部コマンドとして実行しますが、生成した 子プロセスの終了を待ち合わせません。生成した子プロセスのプロセスIDを返します。

...din), 1(stdout), 2(stderr) 以外の
ファイルデスクリプタをすべて閉じます。
false がデフォルトです。

: :exception
Kernel
.#system のみで指定できます。
これを true に設定すると、nil や false を返す代わりに例外が発生します。
fa...
...列を指定します。
@param options オプションパラメータ Hash

@raise ArgumentError 第一引数が配列かつ要素数が 2 でない場合に発生します。

@raise Errno::EXXX コマンドが実行できなかった場合に発生します。

@see Kernel.#system,Kernel.#exec...

Kernel.#system(command, options={}) -> bool | nil (604.0)

引数を外部コマンドとして実行して、成功した時に真を返します。

...# => Errno::ENOENT (No such file or directory - sad)
system('ruby -e "exit(false)"', exception: true) # => RuntimeError (Command failed with exit 1: ruby -e "exit(false)")
system('ruby -e "exit(true)"', exception: true) # => true
//}

@see Kernel.#`,Kernel.#spawn,Kernel.#exec,system(3)...

Kernel.#system(env, command, options={}) -> bool | nil (604.0)

引数を外部コマンドとして実行して、成功した時に真を返します。

...# => Errno::ENOENT (No such file or directory - sad)
system('ruby -e "exit(false)"', exception: true) # => RuntimeError (Command failed with exit 1: ruby -e "exit(false)")
system('ruby -e "exit(true)"', exception: true) # => true
//}

@see Kernel.#`,Kernel.#spawn,Kernel.#exec,system(3)...

絞り込み条件を変える

Kernel.#system(env, program, *args, options={}) -> bool | nil (604.0)

引数を外部コマンドとして実行して、成功した時に真を返します。

...umask
* 子プロセスでのリダイレクト
などを変更できます。環境変数のクリアなども指定できます。
詳しくは Kernel.#spawn を参照してください。

=== 引数の解釈

この形式で呼び出した場合、空白や shell のメタキャラクタも...
...se RuntimeError exception: true が指定されていて、コマンドの終了ステータスが 0 以外のときに発生します。

//emlist[インタプリタから直接コマンドを実行][ruby]{
system("echo", "*") # => true
# *
//}

@see Kernel.#`,Kernel.#spawn,Kernel.#exec,system(3)...

Kernel.#system(program, *args, options={}) -> bool | nil (604.0)

引数を外部コマンドとして実行して、成功した時に真を返します。

...umask
* 子プロセスでのリダイレクト
などを変更できます。環境変数のクリアなども指定できます。
詳しくは Kernel.#spawn を参照してください。

=== 引数の解釈

この形式で呼び出した場合、空白や shell のメタキャラクタも...
...se RuntimeError exception: true が指定されていて、コマンドの終了ステータスが 0 以外のときに発生します。

//emlist[インタプリタから直接コマンドを実行][ruby]{
system("echo", "*") # => true
# *
//}

@see Kernel.#`,Kernel.#spawn,Kernel.#exec,system(3)...

Kernel#namespace(name = nil) { ... } -> Rake::NameSpace (340.0)

新しい名前空間を作成します。

新しい名前空間を作成します。

与えられたブロックを評価する間は、その名前空間を使用します。

例:
ns = namespace "nested" do
task :run
end
task_run = ns[:run] # find :run in the given namespace.

@see Rake::TaskManager#in_namespace