るりまサーチ

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

別のキーワード

  1. _builtin nil?
  2. nilclass nil?
  3. object nil?
  4. _builtin nil
  5. object nil

検索結果

<< 1 2 3 ... > >>

Kernel.#caller_locations(start = 1, length = nil) -> [Thread::Backtrace::Location] | nil (6426.0)

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

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

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

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

@pa...
...1(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)
# => ["/Users/user/...
...(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$$LAST_MATCH_INFO -> MatchData | nil (6408.0)

$~ の別名

...f=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.txt"
p $LAST_MATCH_INFO[2] #=> nil
end...

Kernel.#Float(arg, exception: true) -> Float | nil (6326.0)

引数を浮動小数点数(Float)に変換した結果を返します。

...引数を浮動小数点数(Float)に変換した結果を返します。

引数が数値の場合は素直に変換し、文字列の場合
は整数や浮動小数点数と見なせるもののみ変換します。

メソッド Float は文字列に対し String#to_f よりも厳密な変換を...
...た場合、
例外を発生する代わりに nil を返します。
@raise ArgumentError 整数や浮動小数点数と見なせない文字列を引数に指定した場合に発生します。
@raise TypeError nil またはメソッド to_f を持たないオブジェクトを...
...][ruby]{
p Float(4) #=> 4.0
p Float(4_000) #=> 4000.0
p Float(9.88) #=> 9.88

p Float(Time.gm(1986)) #=> 504921600.0
p Float(Object.new) # can't convert Object into Float (TypeError)
p Float(nil) # can't convert nil into Float (TypeError)

p Float("10") #...

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

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

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

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

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

@pa...
...1(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)
# => ["/Users/user/...
...(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.#Rational(x, y = 1, exception: true) -> Rational | nil (6314.0)

引数を有理数(Rational)に変換した結果を返します。

...引数を有理数(Rational)に変換した結果を返します。

@param x 変換対象のオブジェクトです。

@param y 変換対象のオブジェクトです。省略した場合は x だけを用いて
Rational オブジェクトを作成します。

@param exception false...
... nil を返します。

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

引数 x、y の両方を指定した場合、x/y した Rational オブジェクトを
返します。

//emlist[例][ruby]{
Rational("1/3") # => (1/3)
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$$CHILD_STATUS -> Process::Status | nil (6302.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.#Float(arg) -> Float (6219.0)

引数を浮動小数点数(Float)に変換した結果を返します。

...引数を浮動小数点数(Float)に変換した結果を返します。

引数が数値の場合は素直に変換し、文字列の場合
は整数や浮動小数点数と見なせるもののみ変換します。

メソッド Float は文字列に対し String#to_f よりも厳密な変換を...
...TypeError nil またはメソッド to_f を持たないオブジェクトを引数に指定したか、
to_f が浮動小数点数を返さなかった場合に発生します。

//emlist[例][ruby]{
p Float(4) #=> 4.0
p Float(4_000) #=> 4000.0
p Float(9.88)...
...at(Time.gm(1986)) #=> 504921600.0
p Float(Object.new) # can't convert Object into Float (TypeError)
p Float(nil) # can't convert nil into Float (TypeError)

p Float("10") #=> 10.0
p Float("10e2") #=> 1000.0
p Float("1e-2") #=> 0.01
p Float(".1") #=> 0.1
p Float...

Kernel.#Rational(x, y = 1) -> Rational (6207.0)

引数を有理数(Rational)に変換した結果を返します。

...引数を有理数(Rational)に変換した結果を返します。

@param x 変換対象のオブジェクトです。

@param y 変換対象のオブジェクトです。省略した場合は x だけを用いて
Rational オブジェクトを作成します。


@raise ArgumentError...
...。また、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...
...される
Rational("0x10") # => ArgumentError
//}

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

//emlist[例][ruby]{
Rational(Object.new) # => ArgumentError
Rational("") # => ArgumentError
Rational(nil) # =>...

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

@todo ???

@todo ???

...

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

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

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

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

@todo ???

@todo ???

...

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

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

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

絞り込み条件を変える

Kernel$$FIELD_SEPARATOR -> String | nil (6203.0)

$; の別名

...$; の別名

require "English"

str = "hoge,fuga,ugo,bar,foo"
p str.split #=> ["hoge,fuga,ugo,bar,foo"]
$FIELD_SEPARATOR = ","
p str.split #=> ["hoge", "fuga", "ugo", "bar", "foo"]...

Kernel$$INPUT_RECORD_SEPARATOR -> String | nil (6203.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 ... > >>