Created
December 7, 2011 16:28
-
-
Save ka8725/1443466 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Andrey-Mac-BookPro:2 ka8725$ irb | |
| irb(main):001:0> class A | |
| irb(main):002:1> attr_accessor :b | |
| irb(main):003:1> end | |
| => nil | |
| irb(main):004:0> a = A.new | |
| => #<A:0x10766f9b0> # эта хрень и есть inspect | |
| irb(main):005:0> a.inspect | |
| => "#<A:0x10766f9b0>" # видишь вывод тот же | |
| irb(main):006:0> a.b = 10 | |
| => 10 | |
| irb(main):007:0> a.inspect | |
| => "#<A:0x10766f9b0 @b=10>" # я забил значение 10 в переменную @b. Теперь inspect показывает что она еть в объекте | |
| irb(main):008:0> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment