るりまサーチ (Ruby 3.3)

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

別のキーワード

  1. _builtin to_c
  2. etc sc_2_c_dev
  3. etc sc_2_c_bind
  4. tracer display_c_call
  5. tracer display_c_call=

ライブラリ

キーワード

検索結果

<< 1 2 > >>

Kernel.#caller_locations(range) -> [Thread::Backtrace::Location] | nil (36988.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 (36988.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#enable_config(config, default) {|config, default| ... } -> bool | String (18904.0)

configure のオプションを検査します。

configure のオプションを検査します。

configure のオプションに --enable-<config> が指定された場合は、真を返し
ます。--disable-<config> が指定された場合は。偽を返します。どちらでもな
い場合は default を返します。

これはデバッグ情報などのカスタム定義を、追加するのに役立ちます。

@param config configure のオプションの名前を指定します。

@param default デフォルト値を返します。


require 'mkmf'
if enable_config("debug")
...

Kernel#with_config(config, default = nil) {|config, default| ... } -> bool | String (18904.0)

configure のオプションを検査します。

configure のオプションを検査します。

configure のオプションに --with-<config> が指定された場合は真を返しま
す。--without-<config> が指定された場合は偽を返します。どちらでもない場
合は default を返します。

これはデバッグ情報などのカスタム定義を、追加するのに役立ちます。

@param config configure のオプションの名前を指定します。

@param default デフォルト値を返します。


require 'mkmf'
if with_config("debug")
$defs...

Kernel.#BigDecimal(s, exception: true) -> BigDecimal | nil (18730.0)

引数で指定した値を表す BigDecimal オブジェクトを生成します。

引数で指定した値を表す BigDecimal オブジェクトを生成します。

@param s 数値を表現する初期値を文字列、Integer、
Float、Rational、BigDecimal オブジェクトのい
ずれかで指定します。
文字列中のスペースは無視されます。また、判断できない文字が出現
した時点で文字列は終了したものとみなされます。

@param n 必要な有効桁数(self の最大有効桁数)を整数で指定します。 n が
0 または省略されたときは、n の値は s の有効桁数とみなされます。...

絞り込み条件を変える

Kernel.#BigDecimal(s, n, exception: true) -> BigDecimal | nil (18730.0)

引数で指定した値を表す BigDecimal オブジェクトを生成します。

引数で指定した値を表す BigDecimal オブジェクトを生成します。

@param s 数値を表現する初期値を文字列、Integer、
Float、Rational、BigDecimal オブジェクトのい
ずれかで指定します。
文字列中のスペースは無視されます。また、判断できない文字が出現
した時点で文字列は終了したものとみなされます。

@param n 必要な有効桁数(self の最大有効桁数)を整数で指定します。 n が
0 または省略されたときは、n の値は s の有効桁数とみなされます。...

Kernel.#Complex(r, i = 0, exception: true) -> Complex | nil (18670.0)

実部が r、虚部が i である Complex クラスのオブジェクトを生成します。

実部が r、虚部が i である Complex クラスのオブジェクトを生成します。

@param r 生成する複素数の実部。

@param i 生成する複素数の虚部。省略した場合は 0 です。

@param s 生成する複素数を表す文字列。

@param exception false を指定すると、変換できなかった場合、
例外を発生する代わりに nil を返します。

@raise ArgumentError 変換できないオブジェクトを指定した場合に発生します。

//emlist[例][ruby]{
Complex(1) # => (...

Kernel.#Complex(s, exception: true) -> Complex | nil (18670.0)

実部が r、虚部が i である Complex クラスのオブジェクトを生成します。

実部が r、虚部が i である Complex クラスのオブジェクトを生成します。

@param r 生成する複素数の実部。

@param i 生成する複素数の虚部。省略した場合は 0 です。

@param s 生成する複素数を表す文字列。

@param exception false を指定すると、変換できなかった場合、
例外を発生する代わりに nil を返します。

@raise ArgumentError 変換できないオブジェクトを指定した場合に発生します。

//emlist[例][ruby]{
Complex(1) # => (...

Kernel.#set_trace_func(proc) -> Proc (18640.0)

Ruby インタプリタのイベントをトレースする Proc オブジェクトとして 指定された proc を登録します。 nil を指定するとトレースがオフになります。

...uby]{
set_trace_func lambda {|*arg|
p arg
}
class Foo
end
43.to_s

# ----結果----
# ["c-return", "..", 1, :set_trace_func, #<Binding:0xf6ceb8>, Kernel]
# ["line", "..", 4, nil, #<Binding:0x10cbcd8>, nil]
# ["c-call", "..", 4, :inherited, #<Binding:0x10cba98>, Class]
# ["c-return", "..", 4, :inhe...
...["class", "..", 4, nil, #<Binding:0x10cb600>, nil]
# ["end", "..", 5, nil, #<Binding:0x10cb3f0>, nil]
# ["line", "..", 6, nil, #<Binding:0x10cb1e0>, nil]
# ["c-call", "..", 6, :to_s, #<Binding:0x10cafd0>, Fixnum]
# ["c-return", "..", 6, :to_s, #<Binding:0x10cad78>, Fixnum]
//}

@see Kernel.#caller...

Kernel#have_macro(macro, headers = nil, opt = "") -> bool (18622.0)

与えられた macro が共通のヘッダファイルか headers に定義されている場合は真を返します。 そうでない場合は偽を返します。

与えられた macro が共通のヘッダファイルか headers に定義されている場合は真を返します。
そうでない場合は偽を返します。

@param macro マクロの名前を指定します。

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

@param opt C コンパイラに渡すコマンドライン引数を指定します。

絞り込み条件を変える

Kernel#have_macro(macro, headers = nil, opt = "") { ... } -> bool (18622.0)

与えられた macro が共通のヘッダファイルか headers に定義されている場合は真を返します。 そうでない場合は偽を返します。

与えられた macro が共通のヘッダファイルか headers に定義されている場合は真を返します。
そうでない場合は偽を返します。

@param macro マクロの名前を指定します。

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

@param opt C コンパイラに渡すコマンドライン引数を指定します。

Kernel#try_constant(const, headers = nil, opt = "") -> Integer | nil (18622.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 (18622.0)

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

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

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

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

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

Kernel#DelegateClass(superclass) -> object (18604.0)

クラス superclass のインスタンスへメソッドを委譲するクラスを定義し、 そのクラスを返します。

クラス superclass のインスタンスへメソッドを委譲するクラスを定義し、
そのクラスを返します。

@param superclass 委譲先となるクラス

例:

//emlist{
require 'delegate'

class ExtArray < DelegateClass(Array)
def initialize
super([])
end
end
a = ExtArray.new
p a.class # => ExtArray
a.push 25
p a # => [25]
//}

Kernel#arg_config(config, default) { ... } -> object | String | true | nil (18604.0)

configure オプション --config の値を返します。

configure オプション --config の値を返します。

@param config オプションを文字列で指定します。

@param default 引数 config で指定したオプションのデフォルト値を指定します。

@return オプションが指定されてた場合は true を、指定されなかった場合は
nil を返します。
引数 default、あるいはブロックを指定すると、オプションが指定さ
れていない場合に引数 default の値かブロックの評価結果を返します
(両方指定した場合はブロックが優先されます)...

絞り込み条件を変える

Kernel#enable_config(config, default) -> bool | String (18604.0)

configure のオプションを検査します。

configure のオプションを検査します。

configure のオプションに --enable-<config> が指定された場合は、真を返し
ます。--disable-<config> が指定された場合は。偽を返します。どちらでもな
い場合は default を返します。

これはデバッグ情報などのカスタム定義を、追加するのに役立ちます。

@param config configure のオプションの名前を指定します。

@param default デフォルト値を返します。


require 'mkmf'
if enable_config("debug")
...

Kernel#file_create(*args) { ... } -> Rake::FileCreationTask (18604.0)

ファイルを作成するタスクを定義します。

...ファイルを作成するタスクを定義します。

主に Kernel.#directory を定義するために使用します。...

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

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

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

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

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

@see Rake::TaskManager#in_namespace

Kernel#with_config(config, default = nil) -> bool | String (18604.0)

configure のオプションを検査します。

configure のオプションを検査します。

configure のオプションに --with-<config> が指定された場合は真を返しま
す。--without-<config> が指定された場合は偽を返します。どちらでもない場
合は default を返します。

これはデバッグ情報などのカスタム定義を、追加するのに役立ちます。

@param config configure のオプションの名前を指定します。

@param default デフォルト値を返します。


require 'mkmf'
if with_config("debug")
$defs...

Kernel$$LAST_MATCH_INFO -> MatchData | nil (18604.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.#putc(ch) -> object (18376.0)

文字 ch を 標準出力 $stdout に出力します。

文字 ch を 標準出力 $stdout に出力します。

ch が数値なら 0 〜 255 の範囲の対応する文字を出力します。
ch が文字列なら、その先頭1文字を出力します。
どちらでもない場合は、ch.to_int で整数に変換を試みます。

@param ch 出力する文字です。数または文字列で指定します。
@return ch を返します
@raise RangeError Bignum を引数にした場合に発生します。
@raise IOError 標準出力が書き込み用にオープンされていなければ発生します。
@raise Errno::EXXX 出力に失敗した場合に発生します。
@...

Kernel#create_tmpsrc(src) -> String (18370.0)

与えられた C プログラムのソースコードを一時ファイルに出力して与えられたソースコードを返します。

与えられた C プログラムのソースコードを一時ファイルに出力して与えられたソースコードを返します。

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

Kernel#egrep_cpp(pattern, src, opt = "") -> bool (18370.0)

C プログラムのソースコード src をプリプロセスし、 その結果が正規表現 pattern にマッチするかどうかを判定します。

C プログラムのソースコード src をプリプロセスし、
その結果が正規表現 pattern にマッチするかどうかを判定します。

CPP $CFLAGS opt | egrep pat

を実行し、その結果が正常かどうかを true または false で返します。

このメソッドはヘッダファイルに関数などの宣言があるかどうか
検査するために使用します。

@param pattern 「egrep の」正規表現を文字列で指定します。
Ruby の正規表現ではありません。

@param src C 言語のソースコードを文字列で記述します。

@see ...

Kernel#egrep_cpp(pattern, src, opt = "") { ... } -> bool (18370.0)

C プログラムのソースコード src をプリプロセスし、 その結果が正規表現 pattern にマッチするかどうかを判定します。

C プログラムのソースコード src をプリプロセスし、
その結果が正規表現 pattern にマッチするかどうかを判定します。

CPP $CFLAGS opt | egrep pat

を実行し、その結果が正常かどうかを true または false で返します。

このメソッドはヘッダファイルに関数などの宣言があるかどうか
検査するために使用します。

@param pattern 「egrep の」正規表現を文字列で指定します。
Ruby の正規表現ではありません。

@param src C 言語のソースコードを文字列で記述します。

@see ...

Kernel#log_src(src) -> () (18370.0)

与えられた C プログラムのソースコードをログ出力します。

与えられた C プログラムのソースコードをログ出力します。

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

絞り込み条件を変える

Kernel#try_compile(src, opt = "", *opts) -> bool (18370.0)

与えられた C のソースコードがコンパイルできた場合は真を返します。 コンパイルできなかった場合は偽を返します。

与えられた C のソースコードがコンパイルできた場合は真を返します。
コンパイルできなかった場合は偽を返します。

ブロックを与えた場合、そのブロックはコンパイル前に評価されます。
ブロック内でソースコードを変更することができます。

@param src C のソースコードを指定します。

@param opt コンパイラに渡すオプションを指定します。
$CFLAGS もコンパイラには渡されます。

Kernel#try_compile(src, opt = "", *opts) { ... } -> bool (18370.0)

与えられた C のソースコードがコンパイルできた場合は真を返します。 コンパイルできなかった場合は偽を返します。

与えられた C のソースコードがコンパイルできた場合は真を返します。
コンパイルできなかった場合は偽を返します。

ブロックを与えた場合、そのブロックはコンパイル前に評価されます。
ブロック内でソースコードを変更することができます。

@param src C のソースコードを指定します。

@param opt コンパイラに渡すオプションを指定します。
$CFLAGS もコンパイラには渡されます。

Kernel#try_cpp(src, opt = "", *opts) -> bool (18370.0)

C プログラムのソースコード src をプリプロセスします。

C プログラムのソースコード src をプリプロセスします。

$CPPFLAGS, $CFLAGS の値もプリプロセッサにコマンドライン引数
として渡します。

このメソッドはヘッダファイルの存在チェックなどに使用します。

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

@param opt プリプロセッサにコマンドライン引数として渡す値を指定します。

@return 問題なくプリプロセスできたら true を返します。
プリプロセスに失敗したら false を返します。

例:

require 'mkmf'
if try_cpp("#in...

Kernel#try_cpp(src, opt = "", *opts) { ... } -> bool (18370.0)

C プログラムのソースコード src をプリプロセスします。

C プログラムのソースコード src をプリプロセスします。

$CPPFLAGS, $CFLAGS の値もプリプロセッサにコマンドライン引数
として渡します。

このメソッドはヘッダファイルの存在チェックなどに使用します。

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

@param opt プリプロセッサにコマンドライン引数として渡す値を指定します。

@return 問題なくプリプロセスできたら true を返します。
プリプロセスに失敗したら false を返します。

例:

require 'mkmf'
if try_cpp("#in...

Kernel.#trace_var(varname) {|new_val| .... } -> nil (18358.0)

グローバル変数 varname への代入のフックを登録します。

...は明示的な代入だけです。
フックは複数登録できます。

フックを解除するには、hook に nil を
指定するか、Kernel.#untrace_var を用います。

hook が nil ならば、設定されていた
hook をすべて解除してその配列を返します(ブロッ...
...ます。解除した場合は解除した
フックを並べた配列を返します。

//emlist[例][ruby]{
trace_var(:$v){|val| puts "hook: $v=#{val.inspect}" }
$v = 1 #=> hook: $v=1
$v = "foo" #=> hook: $v="foo"
$v.upcase!
p $v #=> "FOO"
//}

@see Kernel.#untrace_var...

絞り込み条件を変える

Kernel.#trace_var(varname, hook) -> [String|Proc] (18358.0)

グローバル変数 varname への代入のフックを登録します。

...は明示的な代入だけです。
フックは複数登録できます。

フックを解除するには、hook に nil を
指定するか、Kernel.#untrace_var を用います。

hook が nil ならば、設定されていた
hook をすべて解除してその配列を返します(ブロッ...
...ます。解除した場合は解除した
フックを並べた配列を返します。

//emlist[例][ruby]{
trace_var(:$v){|val| puts "hook: $v=#{val.inspect}" }
$v = 1 #=> hook: $v=1
$v = "foo" #=> hook: $v="foo"
$v.upcase!
p $v #=> "FOO"
//}

@see Kernel.#untrace_var...

Kernel.#trace_var(varname, hook) -> nil (18358.0)

グローバル変数 varname への代入のフックを登録します。

...は明示的な代入だけです。
フックは複数登録できます。

フックを解除するには、hook に nil を
指定するか、Kernel.#untrace_var を用います。

hook が nil ならば、設定されていた
hook をすべて解除してその配列を返します(ブロッ...
...ます。解除した場合は解除した
フックを並べた配列を返します。

//emlist[例][ruby]{
trace_var(:$v){|val| puts "hook: $v=#{val.inspect}" }
$v = 1 #=> hook: $v=1
$v = "foo" #=> hook: $v="foo"
$v.upcase!
p $v #=> "FOO"
//}

@see Kernel.#untrace_var...

Kernel.#untrace_var(varname, hook = nil) -> [String|Proc] (18358.0)

グローバル変数 varname に関連付けられたフックを解除します。

...#=> hookB."str",hookA."str",

untrace_var(:$v,block)
$v = 'str' #=> hookA."str",

trace_var(:$v){|val| print "hookC.#{val.inspect}," }
p untrace_var(:$v) #=> [#<Proc:0x02b68f58@..:9>, #<Proc:0x02b6978c@..:3>]
$v = 'str' # なにも出力されない
//}

@see Kernel.#trace_var...

Kernel$$CFLAGS -> String (18352.0)

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

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

Kernel
#dir_config の検査が成功すると、
この変数の値に " -Idir" が追加されます。...

Kernel.#callcc {|cont| .... } -> object (18352.0)

継続を作成します。 Continuation を参照してください。

継続を作成します。 Continuation を参照してください。

絞り込み条件を変える

Kernel#create_makefile(target, srcprefix = nil) -> true (18322.0)

@todo

...@todo

Kernel
#have_library などの各種検査の結果を元に、拡張ライブラリを
ビルドするための Makefile を生成します。

extconf.rb は普通このメソッドの呼び出しで終ります。

@param target ターゲットとなる拡張ライブラリの名前を指...
...create_makefile('foo') {|conf|
[
*conf,
"MACRO_YOU_NEED = something",
]
}

ソースディレクトリに depend ファイルが存在する場合、その内容が
Kernel
#depend_rules メソッドで整形されて、生成される Makefile に加えられます。...

Kernel#try_static_assert(expr, headers = nil, opt = "") -> bool (18322.0)

@todo ???

@todo ???

...

@param expr C 言語の式を指定します。

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

@param opt コンパイラに渡すオプションを指定します。
$CFLAGS もコンパイラには渡されます。

Kernel#try_static_assert(expr, headers = nil, opt = "") { ... } -> bool (18322.0)

@todo ???

@todo ???

...

@param expr C 言語の式を指定します。

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

@param opt コンパイラに渡すオプションを指定します。
$CFLAGS もコンパイラには渡されます。

Kernel.#caller(range) -> [String] | nil (18322.0)

start 段上の呼び出し元の情報を $@ の形式のバックトレース(文字列の配列)として返します。

...します。

@param range 取得したいスタックの範囲を示す Range オブジェクトを指定します。

@see Kernel.#set_trace_func,Kernel.#raise,
Kernel
.#caller_locations

//emlist[例][ruby]{
def foo
p caller(0)
p caller(1)
p caller(2)
p caller(3)
p caller(4)
end

de...

Kernel.#caller(start = 1) -> [String] | nil (18322.0)

start 段上の呼び出し元の情報を $@ の形式のバックトレース(文字列の配列)として返します。

...します。

@param range 取得したいスタックの範囲を示す Range オブジェクトを指定します。

@see Kernel.#set_trace_func,Kernel.#raise,
Kernel
.#caller_locations

//emlist[例][ruby]{
def foo
p caller(0)
p caller(1)
p caller(2)
p caller(3)
p caller(4)
end

de...

絞り込み条件を変える

Kernel.#caller(start, length) -> [String] | nil (18322.0)

start 段上の呼び出し元の情報を $@ の形式のバックトレース(文字列の配列)として返します。

...します。

@param range 取得したいスタックの範囲を示す Range オブジェクトを指定します。

@see Kernel.#set_trace_func,Kernel.#raise,
Kernel
.#caller_locations

//emlist[例][ruby]{
def foo
p caller(0)
p caller(1)
p caller(2)
p caller(3)
p caller(4)
end

de...

Kernel.#syscall(num, *arg) -> Integer (18322.0)

numで指定された番号のシステムコールを実行します。 第2引数以降をシステムコールの引数として渡します。

numで指定された番号のシステムコールを実行します。
第2引数以降をシステムコールの引数として渡します。

どの数値がどのシステムコールに対応するかは、
syscall(2) や
/usr/include/sys/syscall.h を参照してください。

システムコールの慣習に従い、syscall(2)
が -1 を返す場合には例外 Errno::EXXX が発生します。
それ以外では、返した値をそのまま数値で返します。

ライブラリ fiddle を使えばより高レベルな操作ができます。

@param num システムコール番号です。
@param arg 文字列か、整数です。最大 9 ...

Kernel#cc_command(opt = "") -> String (18304.0)

実際にコンパイルする際に使用するコマンドを返します。

実際にコンパイルする際に使用するコマンドを返します。

@param opt コンパイラに与える追加のコマンドライン引数を指定します。

@see RbConfig.expand

Kernel#check_signedness(type, headers = nil, opts = nil) -> "signed" | "unsigned" | nil (18304.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 (18304.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_sizeof(type, headers = nil) -> Integer | nil (18304.0)

与えられた型のサイズを返します。

与えられた型のサイズを返します。

型 type がシステムに存在する場合は、グローバル変数 $defs に
"-DSIZEOF_type=X" を追加し、型のサイズを返します。型 type がシステムに
存在しない場合は、nil を返します。

例えば、

require 'mkmf'
check_sizeof('mystruct') # => 12

である場合、SIZEOF_MYSTRUCT=12 というプリプロセッサマクロをコンパイラに渡します。

@param type 検査したい型を指定します。

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

Kernel#check_sizeof(type, headers = nil) { ... } -> Integer | nil (18304.0)

与えられた型のサイズを返します。

与えられた型のサイズを返します。

型 type がシステムに存在する場合は、グローバル変数 $defs に
"-DSIZEOF_type=X" を追加し、型のサイズを返します。型 type がシステムに
存在しない場合は、nil を返します。

例えば、

require 'mkmf'
check_sizeof('mystruct') # => 12

である場合、SIZEOF_MYSTRUCT=12 というプリプロセッサマクロをコンパイラに渡します。

@param type 検査したい型を指定します。

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

Kernel#chmod -> () (18304.0)

ファイルのアクセス権を変更します。

ファイルのアクセス権を変更します。

Change the mode of each FILE to OCTAL-MODE.

ruby -run -e chmod -- [OPTION] OCTAL-MODE FILE

-v 詳細表示

@see chmod(1)

Kernel#convertible_int(type, headers = nil, opts = nil) (18304.0)

Returns the convertible integer type of the given +type+. You may optionally specify additional +headers+ to search in for the +type+. _Convertible_ means actually same type, or typedefed from same type. If the +type+ is a integer type and _convertible_ type is found, following macros are passed as preprocessor constants to the compiler using the +type+ name, in uppercase. * 'TYPEOF_', followed by the +type+ name, followed by '=X' where 'X' is the found _convertible_ type name. * 'TYP2NUM' and 'NUM2TYP, where 'TYP' is the +type+ name in uppercase with replacing '_t' suffix with 'T', followed by '=X' where 'X' is the macro name to convert +type+ to +Integer+ object, and vice versa. For example, if foobar_t is defined as unsigned long, then convertible_int("foobar_t") would return "unsigned long", and define macros: #define TYPEOF_FOOBAR_T unsigned long #define FOOBART2NUM ULONG2NUM #define NUM2FOOBART NUM2ULONG

Returns the convertible integer type of the given +type+. You may
optionally specify additional +headers+ to search in for the +type+.
_Convertible_ means actually same type, or typedefed from same type.

If the +type+ is a integer type and _convertible_ type is found,
following macros are p...

Kernel#convertible_int(type, headers = nil, opts = nil) { ... } (18304.0)

Returns the convertible integer type of the given +type+. You may optionally specify additional +headers+ to search in for the +type+. _Convertible_ means actually same type, or typedefed from same type. If the +type+ is a integer type and _convertible_ type is found, following macros are passed as preprocessor constants to the compiler using the +type+ name, in uppercase. * 'TYPEOF_', followed by the +type+ name, followed by '=X' where 'X' is the found _convertible_ type name. * 'TYP2NUM' and 'NUM2TYP, where 'TYP' is the +type+ name in uppercase with replacing '_t' suffix with 'T', followed by '=X' where 'X' is the macro name to convert +type+ to +Integer+ object, and vice versa. For example, if foobar_t is defined as unsigned long, then convertible_int("foobar_t") would return "unsigned long", and define macros: #define TYPEOF_FOOBAR_T unsigned long #define FOOBART2NUM ULONG2NUM #define NUM2FOOBART NUM2ULONG

Returns the convertible integer type of the given +type+. You may
optionally specify additional +headers+ to search in for the +type+.
_Convertible_ means actually same type, or typedefed from same type.

If the +type+ is a integer type and _convertible_ type is found,
following macros are p...

絞り込み条件を変える

Kernel#cp -> () (18304.0)

ファイルやディレクトリをコピーします。

ファイルやディレクトリをコピーします。


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

-p 可能であればファイルの属性を保持します。
-r 再帰的にコピーします。
-v 詳細表示

@see cp(1)

Kernel#cpp_command(outfile, opt = "") -> String (18304.0)

実際にプリプロセッサを実行する際に使用するコマンドを返します。

実際にプリプロセッサを実行する際に使用するコマンドを返します。

@param outfile 出力ファイルの名前を指定します。

@param opt プリプロセッサに与える追加のコマンドライン引数を指定します。

@see RbConfig.expand

Kernel#create_header(header = "extconf.h") -> String (18304.0)

Kernel#have_func, Kernel#have_header などの検査結果を元に、 ヘッダファイルを生成します。

...
Kernel
#have_func, Kernel#have_header などの検査結果を元に、
ヘッダファイルを生成します。

このメソッドは extconf.rb の最後で呼び出すようにしてください。

@param header ヘッダファイルの名前を指定します。

@return ヘッダファイ...

Kernel#desc(description) -> String (18304.0)

直後の Rake タスクの説明を登録します。

直後の Rake タスクの説明を登録します。

@param description 直後のタスクの説明を指定します。

例:
desc "Run the Unit Tests"
task :test => [:build] do
runtests
end

Kernel#dir_config(target, idefault = nil, ldefault = nil) -> [String, String] (18304.0)

configure オプション --with-TARGET-dir, --with-TARGET-include, --with-TARGET-lib をユーザが extconf.rb に指定できるようにします。

configure オプション
--with-TARGET-dir,
--with-TARGET-include,
--with-TARGET-lib
をユーザが extconf.rb に指定できるようにします。

--with-TARGET-dir オプションは
システム標準ではない、
ヘッダファイルやライブラリがあるディレクトリをまとめて指定するために使います。
ユーザが extconf.rb に --with-TARGET-dir=PATH を指定したときは
$CFLAGS に "-IPATH/include" を、
$LDFLAGS に "-LPATH/lib" を、
それぞれ追加し...

絞り込み条件を変える

Kernel#directory(dir) -> () (18304.0)

与えられたディレクトリを作成するタスクを定義します。

与えられたディレクトリを作成するタスクを定義します。

@param dir 作成するディレクトリを指定します。

例:
directory 'testdata/doc'

Kernel#find_executable(bin, path = nil) -> String | nil (18304.0)

パス path から実行ファイル bin を探します。

パス path から実行ファイル bin を探します。

実行ファイルが見つかった場合は、そのフルパスを返します。
実行ファイルが見つからなかった場合は、nilを返します。

このメソッドは Makefile を変更しません。

@param bin 実行ファイルの名前を指定します。

@param path パスを指定します。デフォルトは環境変数 PATH です。
環境変数 PATH が定義されていない場合は /usr/local/bin,
/usr/ucb, /usr/bin, /bin を使います。

Kernel#have_func(func, headers = nil) -> bool (18304.0)

関数 func がシステムに存在するかどうかを検査します。

関数 func がシステムに存在するかどうかを検査します。

関数 func が存在すれば $defs に "-DHAVE_func" (func は大文字に変
換されます) を追加して true を返します。関数 func が見つからないときは
グローバル変数を変更せず false を返します。

@param func 関数名を指定します。

@param headers 関数 func を使用するのに必要なヘッダファイル名を指定しま
す。これは関数の型をチェックするためではなく、関数が実際
にはマクロで定義されている場合などの...

Kernel#have_func(func, headers = nil) { ... } -> bool (18304.0)

関数 func がシステムに存在するかどうかを検査します。

関数 func がシステムに存在するかどうかを検査します。

関数 func が存在すれば $defs に "-DHAVE_func" (func は大文字に変
換されます) を追加して true を返します。関数 func が見つからないときは
グローバル変数を変更せず false を返します。

@param func 関数名を指定します。

@param headers 関数 func を使用するのに必要なヘッダファイル名を指定しま
す。これは関数の型をチェックするためではなく、関数が実際
にはマクロで定義されている場合などの...

Kernel#have_struct_member(type, member, headers = nil) -> bool (18304.0)

member というメンバを持つ構造体 type がシステムに存在するかどうか検査します。

member というメンバを持つ構造体 type がシステムに存在するかどうか検査します。

member というメンバを持つ構造体 type がシステムに存在する場合は、
グローバル変数 $defs に "-DHAVE_type_member" を追加し、真を返します。
member というメンバを持つ構造体 type が存在しない場合は、偽を返します。

例えば

require 'mkmf'
have_struct_member('struct foo', 'bar') # => true

である場合、HAVE_STRUCT_FOO_BAR というプリプロセッサマクロをコンパ...

絞り込み条件を変える

Kernel#have_struct_member(type, member, headers = nil) { ... } -> bool (18304.0)

member というメンバを持つ構造体 type がシステムに存在するかどうか検査します。

member というメンバを持つ構造体 type がシステムに存在するかどうか検査します。

member というメンバを持つ構造体 type がシステムに存在する場合は、
グローバル変数 $defs に "-DHAVE_type_member" を追加し、真を返します。
member というメンバを持つ構造体 type が存在しない場合は、偽を返します。

例えば

require 'mkmf'
have_struct_member('struct foo', 'bar') # => true

である場合、HAVE_STRUCT_FOO_BAR というプリプロセッサマクロをコンパ...

Kernel#link_command(ldflags, opt = "", libpath = $DEFLIBPATH|$LIBPATH) -> String (18304.0)

実際にリンクする際に使用するコマンドを返します。

実際にリンクする際に使用するコマンドを返します。

@param ldflags LDFLAGS に追加する値を指定します。

@param opt LIBS に追加する値を指定します。

@param libpath LIBPATH に指定する値を指定します。

@see RbConfig.expand

Kernel#psych_y(*objects) -> nil (18304.0)

objects を YAML document として標準出力に出力します。

objects を YAML document として標準出力に出力します。

このメソッドは irb 上でのみ定義されます。

syck に y メソッドがあるため、
psych_y が別名として定義されています。将来的に
syck が廃止された場合 psych_y は廃止
される予定であるため、特別の事情がない限り y を用いてください。

@param objects YAML document に変換する Ruby のオブジェクト

Kernel#touch -> () (18304.0)

ファイルのアクセス時刻と修正時刻を現在の時刻に変更します。

ファイルのアクセス時刻と修正時刻を現在の時刻に変更します。


ruby -run -e touch -- [OPTION] FILE

-v 詳細表示

@see touch(1)

Kernel#try_func(func, libs, headers = nil) -> bool (18304.0)

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

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

@param func 関数名を指定します。

@param libs ライブラリの名前を指定します。

@param headers 関数 func を使用するのに必要なヘッダファイ...

絞り込み条件を変える

Kernel#try_func(func, libs, headers = nil) { ... } -> bool (18304.0)

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

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

@param func 関数名を指定します。

@param libs ライブラリの名前を指定します。

@param headers 関数 func を使用するのに必要なヘッダファイ...

Kernel$$CHILD_STATUS -> Process::Status | nil (18304.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

Kernel$$IGNORECASE -> bool (18304.0)

過去との互換性のために残されていますが、もはや何の意味もありません。

過去との互換性のために残されていますが、もはや何の意味もありません。

値は常に false です。代入しても無視されます。

$= の別名

require "English"

$IGNORECASE = true # => warning: variable $= is no longer effective; ignored
$IGNORECASE # => warning: variable $= is no longer effective
# false

Kernel$$INPUT_RECORD_SEPARATOR -> String | nil (18304.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$$LAST_PAREN_MATCH -> String | nil (18304.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$$MATCH -> String | nil (18304.0)

$& の別名

$& の別名

require "English"

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

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

Kernel$$POSTMATCH -> String | nil (18304.0)

$' の別名

$' の別名

require "English"

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

/foo/ =~ str
p $POSTMATCH #=> ",bar,hee,hoo"

Kernel$$PREMATCH -> String | nil (18304.0)

$` の別名

$` の別名

require "English"

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

/foo/ =~ str
p $PREMATCH #=> "hoge,"

Kernel$$archdir -> String (18304.0)

マシン固有のライブラリを置くディレクトリです。 通常は "/usr/local/lib/ruby/バージョン/arch" です。

マシン固有のライブラリを置くディレクトリです。
通常は "/usr/local/lib/ruby/バージョン/arch" です。

Kernel$$sitearchdir -> String (18304.0)

サイト固有でかつマシン固有のライブラリを置くディレクトリです。 通常は "/usr/local/lib/ruby/site_ruby/バージョン/arch" です。

サイト固有でかつマシン固有のライブラリを置くディレクトリです。
通常は "/usr/local/lib/ruby/site_ruby/バージョン/arch" です。

絞り込み条件を変える

Kernel$$srcdir -> String (18304.0)

Ruby インタプリタを make したときのソースディレクトリです。

Ruby インタプリタを make したときのソースディレクトリです。

Kernel.#__callee__ -> Symbol | nil (18304.0)

現在のメソッド名を返します。 メソッドの外で呼ばれると nil を返します。

...//emlist[例][ruby]{
def foo
p __callee__
end
alias :bar :foo
foo # => :foo
bar # => :bar
p __callee__ # => nil
//}

Kernel
.#__method__ とは異なり、現在のメソッド名が alias されたメ
ソッドの場合には alias 先のメソッド名を返します。

@see Kernel.#__method__...

Kernel.#block_given? -> bool (18304.0)

メソッドにブロックが与えられていれば真を返します。

メソッドにブロックが与えられていれば真を返します。

このメソッドはカレントコンテキストにブロックが与えられているかを調べるので、
メソッド内部以外で使っても単に false を返します。

iterator? は (ブロックが必ずイテレートするとはいえないので)推奨されていないの
で block_given? を使ってください。

//emlist[例][ruby]{
def check
if block_given?
puts "Block is given."
else
puts "Block isn't given."
end
end
check{} #=...

Kernel.#catch {|tag| .... } -> object (18304.0)

Kernel.#throwとの組み合わせで大域脱出を行います。 catch はブロックを実行します。

...
Kernel
.#throwとの組み合わせで大域脱出を行います。 catch はブロックを実行します。

ブロックの実行中に tag と同一のオブジェクトを引数とする Kernel.#throw が行われた
場合は、その throw の第二引数を戻り値として、ブロック...
...@return ブロックの返り値か、対応するthrowの第二引数を返り値として返します。

//emlist[例][ruby]{
result = catch do |tag|
for i in 1..2
for j in 1..2
for k in 1..2
throw tag, k
end
end
end
end

p result #=> 1
//}

@see Kernel.#throw...

Kernel.#catch(tag) {|tag| .... } -> object (18304.0)

Kernel.#throwとの組み合わせで大域脱出を行います。 catch はブロックを実行します。

...
Kernel
.#throwとの組み合わせで大域脱出を行います。 catch はブロックを実行します。

ブロックの実行中に tag と同一のオブジェクトを引数とする Kernel.#throw が行われた
場合は、その throw の第二引数を戻り値として、ブロック...
...@return ブロックの返り値か、対応するthrowの第二引数を返り値として返します。

//emlist[例][ruby]{
result = catch do |tag|
for i in 1..2
for j in 1..2
for k in 1..2
throw tag, k
end
end
end
end

p result #=> 1
//}

@see Kernel.#throw...

絞り込み条件を変える

Kernel.#chomp(rs = $/) -> String (18304.0)

$_.chomp とほぼ同じですが、置換が発生したときは、$_の内容を置き換える点が異なります。 コマンドラインオプションで -p または -n を指定した時のみ定義されます。

$_.chomp とほぼ同じですが、置換が発生したときは、$_の内容を置き換える点が異なります。
コマンドラインオプションで -p または -n を指定した時のみ定義されます。

暗号的になりすぎるきらいがあるため、このメソッドの使用は推奨されていません。
今後はより明示的な $_.chomp を使ってください。

$_.chomp とこのメソッド chomp は以下の点で違いがあります。

* chomp は $_ の値をコピーして、コピーの方を更新し、
$_ に再代入します。

@param rs 末尾から削除する改行コードを指定します。

//emlist[例: ruby -n...

Kernel.#chop -> String (18304.0)

$_.chop とほぼ同じですが、置換が発生したときは、$_の内容を置き換える点が異なります。 コマンドラインオプションで -p または -n を指定した時のみ定義されます。

$_.chop とほぼ同じですが、置換が発生したときは、$_の内容を置き換える点が異なります。
コマンドラインオプションで -p または -n を指定した時のみ定義されます。

暗号的になりすぎるきらいがあるため、このメソッドの使用は推奨されていません。
今後はより明示的な $_.chop を使ってください。

$_.chopとこのメソッド chop は以下の点で違いがあります。

* chop は $_ の値をコピーして、コピーの方を更新し、
$_ に再代入します。

//emlist[例][ruby]{
$_ = "test\r\n"
$_ # => "test...

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

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

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

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

=== 引数の解釈

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

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

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

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

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

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

=== 引数の解釈

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

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

Kernel.#exec(env, program, *args, options={}) -> () (18304.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={}) -> () (18304.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.#local_variables -> [Symbol] (18304.0)

現在のスコープで定義されているローカル変数名の配列を返します。

...現在のスコープで定義されているローカル変数名の配列を返します。

//emlist[例][ruby]{
yuyu = 0
p local_variables #=> [:yuyu]
//}

@see Kernel.#global_variables,Object#instance_variables,Module.constants,Module#constants,Module#class_variables...

Kernel.#select(reads, writes = [], excepts = [], timeout = nil) -> [[IO]] | nil (18304.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::CONFIG -> Hash (18304.0)

RbConfig::MAKEFILE_CONFIG と同じです。

RbConfig::MAKEFILE_CONFIG と同じです。

Kernel.#proc { ... } -> Proc (9796.0)

与えられたブロックから手続きオブジェクト (Proc のインスタンス) を生成して返します。Proc.new に近い働きをします。

...生します。][ruby]{
pr = Proc.new { break }
(1..5).each(&pr)
//}

===[a:lambda_proc] lambda と proc と Proc.new とイテレータの違い

Kernel
.#lambda と Proc.new はどちらも Proc クラスのインスタンス(手続きオブジェクト)を生成しますが、
生成された手...
...。 lambda の生成する手続きオブジェクトのほうが
よりメソッドに近い働きをするように設計されています。

Kernel
.#proc は Proc.new と同じになります。
引数に & を付けることで手続きオブジェクト化したブロックは、Proc.new で...

絞り込み条件を変える

Kernel#y(*objects) -> nil (9304.0)

objects を YAML document として標準出力に出力します。

objects を YAML document として標準出力に出力します。

このメソッドは irb 上でのみ定義されます。

syck に y メソッドがあるため、
psych_y が別名として定義されています。将来的に
syck が廃止された場合 psych_y は廃止
される予定であるため、特別の事情がない限り y を用いてください。

@param objects YAML document に変換する Ruby のオブジェクト

Kernel$$KCODE -> object (9304.0)

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

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

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

@see spec/rubycmd

Kernel$$OUTPUT_RECORD_SEPARATOR -> String | nil (9304.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$$PROCESS_ID -> Integer (9304.0)

$$ の別名

$$ の別名

require "English"

p sprintf("something%s", $PID) #=> "something5543" など

Kernel$$RS -> String | nil (9004.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.#iterator? -> bool (9004.0)

メソッドにブロックが与えられていれば真を返します。

メソッドにブロックが与えられていれば真を返します。

このメソッドはカレントコンテキストにブロックが与えられているかを調べるので、
メソッド内部以外で使っても単に false を返します。

iterator? は (ブロックが必ずイテレートするとはいえないので)推奨されていないの
で block_given? を使ってください。

//emlist[例][ruby]{
def check
if block_given?
puts "Block is given."
else
puts "Block isn't given."
end
end
check{} #=...

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.#lambda { ... } -> Proc (496.0)

与えられたブロックから手続きオブジェクト (Proc のインスタンス) を生成して返します。Proc.new に近い働きをします。

...生します。][ruby]{
pr = Proc.new { break }
(1..5).each(&pr)
//}

===[a:lambda_proc] lambda と proc と Proc.new とイテレータの違い

Kernel
.#lambda と Proc.new はどちらも Proc クラスのインスタンス(手続きオブジェクト)を生成しますが、
生成された手...
...。 lambda の生成する手続きオブジェクトのほうが
よりメソッドに近い働きをするように設計されています。

Kernel
.#proc は Proc.new と同じになります。
引数に & を付けることで手続きオブジェクト化したブロックは、Proc.new で...

Kernel.#open(file, mode_enc = "r", perm = 0666) -> IO (454.0)

file をオープンして、IO(Fileを含む)クラスのインスタンスを返します。

file をオープンして、IO(Fileを含む)クラスのインスタンスを返します。

ブロックが与えられた場合、指定されたファイルをオープンし、
生成した IO オブジェクトを引数としてブロックを実行します。
ブロックの終了時や例外によりブロックを脱出するとき、
ファイルをクローズします。ブロックを評価した結果を返します。

ファイル名 file が `|' で始まる時には続く文字列をコマンドとして起動し、
コマンドの標準入出力に対してパイプラインを生成します

ファイル名が "|-" である時、open は Ruby の子プロセス
を生成し、その子プロセスとの間のパイプ(IOオブジェクト)を...

Kernel.#open(file, mode_enc = "r", perm = 0666) {|io| ... } -> object (454.0)

file をオープンして、IO(Fileを含む)クラスのインスタンスを返します。

file をオープンして、IO(Fileを含む)クラスのインスタンスを返します。

ブロックが与えられた場合、指定されたファイルをオープンし、
生成した IO オブジェクトを引数としてブロックを実行します。
ブロックの終了時や例外によりブロックを脱出するとき、
ファイルをクローズします。ブロックを評価した結果を返します。

ファイル名 file が `|' で始まる時には続く文字列をコマンドとして起動し、
コマンドの標準入出力に対してパイプラインを生成します

ファイル名が "|-" である時、open は Ruby の子プロセス
を生成し、その子プロセスとの間のパイプ(IOオブジェクト)を...

絞り込み条件を変える

<< 1 2 > >>