るりまサーチ

最速Rubyリファレンスマニュアル検索!
22件ヒット [1-22件を表示] (0.030秒)
トップページ > クラス:Object[x] > クエリ:to_int[x] > 種類:インスタンスメソッド[x]

別のキーワード

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

ライブラリ

検索結果

Object#to_int -> Integer (18109.0)

オブジェクトの Integer への暗黙の変換が必要なときに内部で呼ばれます。 デフォルトでは定義されていません。

...
デフォルトでは定義されていません。

説明のためここに記載してありますが、
このメソッドは実際には Object クラスには定義されていません。
必要に応じてサブクラスで定義すべきものです。

このメソッドを定義する...
...が使われるすべての場面で代置可能であるような、
* 整数そのものとみなせるようなもの
という厳しいものになっています。

//emlist[][ruby]{
class Foo
def to_int
1
end
end

ary = [:a, :b, :c]
p(ary[Foo.new]) # => :b
//}

@see Kernel.#Integer...

Object#public_method(name) -> Method (14.0)

オブジェクトの public メソッド name をオブジェクト化した Method オブジェクトを返します。

...vate メソッド名を引数として与えると発生します。

//emlist[][ruby]{
1.public_method(:to_int) #=> #<Method: Integer#to_int>
1.public_method(:p) # method `p' for class `Integer' is private (NameError)
//}

@see Object#method,Object#public_send,Module#public_instance_method...