るりまサーチ

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

別のキーワード

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

ライブラリ

キーワード

検索結果

<< 1 2 3 ... > >>

Kernel.#binding -> Binding (12407.0)

変数・メソッドなどの環境情報を含んだ Binding オブジェクトを 生成して返します。通常、Kernel.#eval の第二引数として使います。

...変数・メソッドなどの環境情報を含んだ Binding オブジェクトを
生成して返します。通常、Kernel.#eval の第二引数として使います。

//emlist[例][ruby]{
def foo
a = 1
binding
end


eval("p a", foo) #=> 1
//}

@see Kernel.#eval,Object::TOPLEVEL_BINDING...

Kernel$$INPUT_LINE_NUMBER -> Integer (12319.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#enable_config(config, default) {|config, default| ... } -> bool | String (6307.0)

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

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

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

これはデバ...
...義を、追加するのに役立ちます。

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

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


require 'mkmf'
i
f enable_config("debug")
$defs.push("-DOSSL_DEBUG") unless $defs.include? "-DOSSL_DEBUG"
end
...

Kernel.#fail(error_type, message = nil, backtrace = caller(0), cause: $!) -> () (6237.0)

例外を発生させます。 発生した例外は変数 $! に格納されます。また例外が 発生した時のスタックトレースは変数 $@ に格納され ます。発生した例外は rescue 節で捕捉できます。

...RuntimeError を発生させます。

//emlist[例][ruby]{
begin
open("nonexist")
rescue
raise #=> `open': No such file or directory - "nonexist" (Errno::ENOENT)
end

//}

引数を渡した場合は、例外メッセージ message を持った error_type の示す例外(省略時 RuntimeErro...
...例外ではないクラスやオブジェクトを指定した場合、
そのオブジェクトの exception メソッドが返す値を発生する例外にします。
その際、exception メソッドに引数として変数 message を渡すことができます。

@param error_type 発生...
...生時のスタックトレースで、Kernel.#caller の戻り値と同じ
形式で指定しなければいけません。
@param cause 現在の例外($!)の代わりに Exception#cause に設定する例外を指定します。
@raise TypeError exception メソッドが例外オブジェクト...
...で、Kernel.#caller の戻り値と同じ
形式で指定しなければいけません。
@param cause 現在の例外($!)の代わりに Exception#cause に設定する例外を指定します。
Exception オブジェクトまたは nil を指定できます。
@raise TypeError exception メ...

Kernel#file(*args) { ... } -> Rake::FileTask (6225.0)

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

...ル名を指定します。

例:
file "config.cfg" => ["config.template"] do
open("config.cfg", "w") do |outfile|
open("config.template") do |infile|
while line = infile.gets
outfile.puts line
end

end

end

end


@see Rake::Task.define_task...

絞り込み条件を変える

Kernel$$LAST_READ_LINE -> String | nil (6219.0)

$_ の別名

...$_ の別名

1 e
2 f
3 g
4 h
5 i
# end of a.txt

ruby -rEnglish -ne'p $LAST_READ_LINE' a.txt
#=>
"1 e\n"
"2 f\n"
"3 g\n"
"4 h\n"
"5 i\n"...

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

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

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

@param start 開始フレームの位置を数値で指定します。

@param length 取得するフレームの個数を指定します。

@pa...
...

//emlist[例][ruby]{
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 # => []...
...(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 (6219.0)

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

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

@param start 開始フレームの位置を数値で指定します。

@param length 取得するフレームの個数を指定します。

@pa...
...

//emlist[例][ruby]{
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 # => []...
...(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$$CHILD_STATUS -> Process::Status | nil (6213.0)

$? の別名

...$? の別名

require "English"

out = `wget https://www.ruby-lang.org/en/about/license.txt -O - 2>/dev/null`

i
f $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$$INPUT_RECORD_SEPARATOR -> String | nil (6213.0)

$/ の別名

...$/ の別名

require "English"

$INPUT_RECORD_SEPARATOR = '|'
array = []
while line = DATA.gets
array << line
end

p array #=> ["ugo|", "ego|", "fogo\n"]

__END__
ugo|ego|fogo...

絞り込み条件を変える

<< 1 2 3 ... > >>