るりまサーチ

最速Rubyリファレンスマニュアル検索!
393件ヒット [201-300件を表示] (0.533秒)

別のキーワード

  1. _builtin inspect
  2. _builtin []
  3. _builtin to_s
  4. _builtin each

ライブラリ

モジュール

キーワード

検索結果

<< < 1 2 3 4 > >>

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

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

...end

foo(4) #=> in method.in rescue.in method.in else.in ensure.
//}

//emlist[例3][ruby]{
class MyException
def exception(mesg=nil)
SecurityError.new(mesg)
end
end

begin
raise MyException.new
rescue SecurityError
p $! #=> #<SecurityError: SecurityError>
end
//}

@see Kernel.#caller...

Kernel.#raise(message, cause: $!) -> () (8013.0)

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

...end

foo(4) #=> in method.in rescue.in method.in else.in ensure.
//}

//emlist[例3][ruby]{
class MyException
def exception(mesg=nil)
SecurityError.new(mesg)
end
end

begin
raise MyException.new
rescue SecurityError
p $! #=> #<SecurityError: SecurityError>
end
//}

@see Kernel.#caller...

Marshal.#dump(obj, limit = -1) -> String (8013.0)

obj を指定された出力先に再帰的に出力します。

...い Class/Module オブジェクト。(この場
合は、例外 ArgumentError が発生します。無名クラスについて
は、Module.new を参照。)
* システムがオブジェクトの状態を保持するもの。具体的には以下のイン
スタンス。Dir, File::Stat,...
...を求めるブロックを持った Hash は
Proc を間接的に指していることになります。

//emlist[例][ruby]{
p Marshal.dump(Hash.new {})
# => -:1:in `dump': cannot dump hash with default proc (TypeError)
//}

マーシャルの動作を任意に定義することもできます。...

Marshal.#dump(obj, port, limit = -1) -> IO (8013.0)

obj を指定された出力先に再帰的に出力します。

...い Class/Module オブジェクト。(この場
合は、例外 ArgumentError が発生します。無名クラスについて
は、Module.new を参照。)
* システムがオブジェクトの状態を保持するもの。具体的には以下のイン
スタンス。Dir, File::Stat,...
...を求めるブロックを持った Hash は
Proc を間接的に指していることになります。

//emlist[例][ruby]{
p Marshal.dump(Hash.new {})
# => -:1:in `dump': cannot dump hash with default proc (TypeError)
//}

マーシャルの動作を任意に定義することもできます。...

ObjectSpace.#undefine_finalizer(obj) -> object (8013.0)

obj に対するファイナライザをすべて解除します。 obj を返します。

...ze"
}
end

def initialize
ObjectSpace.define_finalizer(self, Sample.callback)
end

def undef
ObjectSpace.undefine_finalizer(self)
end
end

Sample.new
GC.start
# => finalize

Sample.new
sample.undef
GC.start
# ※何も出力されない
//}

@see ObjectSpace.#define_finalizer...

絞り込み条件を変える

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

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

...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") #=> 10.0
p...

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

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

...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") #=> 10.0
p...

Kernel.#Integer(arg, base = 0) -> Integer (8007.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 Integer(...

Kernel.#Integer(arg, base = 0, exception: true) -> Integer | nil (8007.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 Integer(...

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

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

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

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

また、Rational('0.3') と Rationa...

絞り込み条件を変える

Kernel.#Rational(x, y = 1, exception: true) -> Rational | nil (8007.0)

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

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

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

また、Rational('0.3') と Rationa...

Kernel.#String(arg) -> String (8007.0)

引数を文字列(String)に変換した結果を返します。

...arg を返します。

@param arg 変換対象のオブジェクトです。
@raise TypeError to_s の返り値が文字列でなければ発生します。

//emlist[例][ruby]{
class Foo
def to_s
"hogehoge"
end
end

arg = Foo.new
p String(arg) #=> "hogehoge"
//}

@see Object#to_s,String...
<< < 1 2 3 4 > >>