are available at http://ruby-hacking- guide.github.io/ • Talking about very details on Ruby source code and implementation. • about Ruby ver. 1.7.3… Compass: Old, But Very Very Useful. 8
“How to read complex source codes” ❖ making a method simple by cutting not essential code off. ❖ understanding object structure before. ❖ and many other wisdoms essence 9
… definition files such as keywords, errors… /ext/ … c extensions such as json, socket… /lib/ …ruby libraries such as csv, irb, yaml, rake… /missing/ …implements of C functions need for ruby, but not all Systems have. /test/ … test codes for ruby implementations. /spec/ … RubySpec will be downloaded here. 16
get index value of @ivar from iv_index_tbl of the class 3. get the value from the array of value of the object by the index obj.instance_variable_get(:@ivar) obj obj Class “ivar” “foo” FALSE nil “ivar2” “buzz” nil “PHP” name index @ivar 0 @name 1 @admin 2 @currency 3 iv_index_tbl 1 2 3 26
is simple ruby value (integer, symbol…) true false Type of Class is T_OBJECT simple ruby value not T_OBJECT generic_iv_tbl own class’s iv_indx_tbl and values 32 nor T_CLASS,T_MODULE