るりまサーチ (Ruby 2.3.0)

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

別のキーワード

  1. _builtin to_s
  2. openssl to_der
  3. openssl to_s
  4. _builtin to_a
  5. openssl to_pem

ライブラリ

クラス

検索結果

Numeric#to_c -> Complex (63379.0)

自身を複素数 (Complex) に変換します。Complex(self, 0) を返します。

自身を複素数 (Complex) に変換します。Complex(self, 0) を返します。

//emlist[例][ruby]{
1.to_c # => (1+0i)
-1.to_c # => (-1+0i)
1.0.to_c # => (1.0+0i)
Rational(1, 2).to_c # => ((1/2)+0i)
//}

Numeric のサブクラスは、このメソッドを適切に再定義しなければなりません。

UnboundMethod#owner -> Class | Module (18322.0)

このメソッドが定義されている class か module を返します。

このメソッドが定義されている class か module を返します。

//emlist[例][ruby]{
Integer.instance_method(:to_s).owner # => Integer
Integer.instance_method(:to_c).owner # => Numeric
Integer.instance_method(:hash).owner # => Kernel
//}