るりまサーチ

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

別のキーワード

  1. objectspace each_object
  2. _builtin each_object
  3. object to_enum
  4. object send
  5. object enum_for

ライブラリ

キーワード

検索結果

Kernel.#throw(tag, value = nil) -> () (220.0)

Kernel.#catchとの組み合わせで大域脱出を行います。 throw は同じ tag を指定した catch のブロックの終わりまでジャンプします。

...
Kernel
.#catchとの組み合わせで大域脱出を行います。 throw
は同じ tag を指定した catch のブロックの終わりまでジャンプします。

throw は探索時に呼び出しスタックをさかのぼるので、
ジャンプ先は同じメソッド内にあるとは限...
...、例外で
スレッドが終了します。

同じ tag であるとは Object#object_id が同じであるという意味です。

@param tag catch の引数に対応する任意のオブジェクトです。
@param value catch の戻り値になります。
@raise ArgumentError 同じ tag で...
...いる catch が存在しない場合に発生します。

//emlist[例][ruby]{
def foo
throw :exit, 25
end

ret = catch(:exit) do
begin
foo
some_process() # 絶対に実行されない
10
ensure
puts "ensure"
end
end
puts ret
#=> ensure
# 25
//}

@see Kernel.#catch...
...、例外で
スレッドが終了します。

同じ tag であるとは Object#object_id が同じであるという意味です。

@param tag catch の引数に対応する任意のオブジェクトです。
@param value catch の戻り値になります。
@raise UncaughtThrowError 同じ tag...

Kernel.#Float(arg) -> Float (149.0)

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

...> 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") #=> 10.0
p Float("10e2") #=>...
...p Float("1e-2") #=> 0.01
p Float(".1") #=> 0.1
p Float("0xa") #=> 10.0

p Float("nan") # invalid value for Float(): "nan" (ArgumentError)
p Float("INF") # invalid value for Float(): "INF" (ArgumentError)
p Float("-Inf") # invalid value for Float(): "-Inf" (Ar...
...* 1000)) #=> Infinity
p Float("0xa.a") # invalid value for Float(): "0xa.a" (ArgumentError)
p Float(" \n10\s \t") #=> 10.0 # 先頭と末尾の空白類は無視される
p Float("1\n0") # invalid value for Float(): "1\n0" (ArgumentError)
p Float("") # invalid value for Float()...

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

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

...> 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") #=> 10.0
p Float("10e2") #=>...
...p Float("1e-2") #=> 0.01
p Float(".1") #=> 0.1
p Float("0xa") #=> 10.0

p Float("nan") # invalid value for Float(): "nan" (ArgumentError)
p Float("INF") # invalid value for Float(): "INF" (ArgumentError)
p Float("-Inf") # invalid value for Float(): "-Inf" (Ar...
...* 1000)) #=> Infinity
p Float("0xa.a") # invalid value for Float(): "0xa.a" (ArgumentError)
p Float(" \n10\s \t") #=> 10.0 # 先頭と末尾の空白類は無視される
p Float("1\n0") # invalid value for Float(): "1\n0" (ArgumentError)
p Float("") # invalid value for Float()...

Kernel.#Integer(arg, base = 0) -> Integer (131.0)

引数を整数 (Fixnum,Bignum) に変換した結果を返します。

...#=> 4
p Integer(4_000) #=> 4000
p Integer(9.88) #=> 9

p Integer(nil) # can't convert nil into Integer (TypeError)
p Integer(Object.new) # cannot convert Object into Integer (TypeError)

p Integer("10") #=> 10
p Integer("10", 2) #=> 2
p Integer("0d10") #=> 10
p I...
...=> 8
p Integer("0o10") #=> 8
p Integer("0x10") #=> 16
p Integer("0b10") #=> 2
p Integer(" \n10\t ") #=> 10 # 先頭と末尾の空白類は無視される
p Integer("1\n0") # `Integer': invalid value for Integer: "1\n0" (ArgumentError)
p Integer("hoge") # `Integer': invalid value...
...for Integer: "hoge" (ArgumentError)
p Integer("") # `Integer': invalid value for Integer: "" (ArgumentError)
//}

@see String#hex,String#oct,String#to_i,Integer...

Kernel.#Integer(arg, base = 0, exception: true) -> Integer | nil (131.0)

引数を整数 に変換した結果を返します。

...#=> 4
p Integer(4_000) #=> 4000
p Integer(9.88) #=> 9

p Integer(nil) # can't convert nil into Integer (TypeError)
p Integer(Object.new) # cannot convert Object into Integer (TypeError)

p Integer("10") #=> 10
p Integer("10", 2) #=> 2
p Integer("0d10") #=> 10
p I...
...=> 8
p Integer("0o10") #=> 8
p Integer("0x10") #=> 16
p Integer("0b10") #=> 2
p Integer(" \n10\t ") #=> 10 # 先頭と末尾の空白類は無視される
p Integer("1\n0") # `Integer': invalid value for Integer: "1\n0" (ArgumentError)
p Integer("hoge") # `Integer': invalid value...
...for Integer: "hoge" (ArgumentError)
p Integer("") # `Integer': invalid value for Integer: "" (ArgumentError)
//}

@see String#hex,String#oct,String#to_i,Integer...

絞り込み条件を変える