るりまサーチ

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

別のキーワード

  1. fiddle ruby_free
  2. rbconfig ruby
  3. fiddle build_ruby_platform
  4. rake ruby
  5. rubygems/defaults ruby_engine

ライブラリ

検索結果

<< < 1 2 >>

Object#to_s -> String (120.0)

オブジェクトの文字列表現を返します。

...ます。

Kernel.#print や Kernel.#sprintf は文字列以外の
オブジェクトが引数に渡された場合このメソッドを使って文字列に変換し
ます。

//emlist[][ruby]{
class Foo
def initialize num
@num = num
end
end
i
t = Foo.new(40)

puts it #=> #<Foo:0x2b69110>...
...class Foo
def to_s
"Class:Foo Number:#{@num}"
end
end

puts it #=> Class:Foo Number:40
//}

@see Object#to_str,Kernel.#String...
<< < 1 2 >>