るりまサーチ

最速Rubyリファレンスマニュアル検索!
4822件ヒット [4801-4822件を表示] (0.072秒)
トップページ > クエリ:Kernel.#p[x] > クエリ:help[x] > クエリ:JSON[x] > クエリ:instance_variables[x]

別のキーワード

  1. win32ole ole_method_help
  2. win32ole ole_obj_help
  3. win32ole ole_show_help
  4. irb/help print_usage
  5. un help

ライブラリ

クラス

モジュール

キーワード

検索結果

<< < ... 47 48 49 >>

Object#to_int -> Integer (12.0)

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

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

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

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

@see Kernel.#Integer...

Object#to_str -> String (12.0)

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

...面で代置可能であるような、
* 文字列そのものとみなせるようなもの
という厳しいものになっています。

//emlist[][ruby]{
class Foo
def to_str
'Edition'
end
end

it = Foo.new
p
('Second' + it) #=> "SecondEdition"
//}

@see Object#to_s,Kernel.#String...
<< < ... 47 48 49 >>