るりまサーチ

最速Rubyリファレンスマニュアル検索!
22件ヒット [1-22件を表示] (0.018秒)
トップページ > クラス:Struct[x] > クエリ:struct[x] > クエリ:new[x] > クエリ:inspect[x]

別のキーワード

  1. struct new
  2. mkmf have_struct_member
  3. struct select
  4. struct each
  5. struct each_pair

ライブラリ

検索結果

Struct#inspect -> String (27156.0)

self の内容を人間に読みやすい文字列にして返します。

...の記述は Struct の下位クラスのインスタンスに対して呼び
出す事を想定しています。Struct.new Struct の下位クラスを作成する点に
注意してください。

//emlist[例][ruby]{
Customer = Struct.new(:name, :address, :zip)
joe = Customer.new("Joe Smith...
...", "123 Maple, Anytown NC", 12345)
joe.inspect # => "#<struct Customer name=\"Joe Smith\", address=\"123 Maple, Anytown NC\", zip=12345>"
//}...

Struct#to_s -> String (12056.0)

self の内容を人間に読みやすい文字列にして返します。

...の記述は Struct の下位クラスのインスタンスに対して呼び
出す事を想定しています。Struct.new Struct の下位クラスを作成する点に
注意してください。

//emlist[例][ruby]{
Customer = Struct.new(:name, :address, :zip)
joe = Customer.new("Joe Smith...
...", "123 Maple, Anytown NC", 12345)
joe.inspect # => "#<struct Customer name=\"Joe Smith\", address=\"123 Maple, Anytown NC\", zip=12345>"
//}...