0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Object#inspect

Posted at

inspect -> String
オブジェクトを人間が読める形式に変換した文字列を返します。

組み込み関数 Kernel.#p は、このメソッドの結果を使用してオブジェクトを表示します。

irb(main):004> [ 1, 2, 3..4, 'five' ].inspect
=> "[1, 2, 3..4, \"five\"]"
irb(main):005> "fafa".inspect
=> "\"fafa\""
irb(main):006> :fafa.inspect
=> ":fafa"
irb(main):007> ["fafa","fafa","fafa"].map!(&:inspect)
=> ["\"fafa\"", "\"fafa\"", "\"fafa\""]
irb(main):008> p ["fafa","fafa","fafa"].map!(&:inspect)
["\"fafa\"", "\"fafa\"", "\"fafa\""]
=> ["\"fafa\"", "\"fafa\"", "\"fafa\""]
irb(main):009> puts ["fafa","fafa","fafa"].map!(&:inspect)
"fafa"
"fafa"
"fafa"
=> nil
...
irb(main):011> p ["fafa","fafa","fafa"]
["fafa", "fafa", "fafa"]
=> ["fafa", "fafa", "fafa"]
irb(main):012> puts ["fafa","fafa","fafa"]
fafa
fafa
fafa
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?