读书人

#Ruby# Introspect (二)

发布时间: 2012-11-11 10:07:57 作者: rapoo

#Ruby# Introspect (2)

3. Looking at Classes

?

superclass => get the parent of any particular class

?

ancestors => get both superclasses and mixin modules

?

在Ruby1.9中,任何未指定的class都继承自Object,而Object继承自BasicObject,BasicObject无superclass。

?

4. Looking inside Classes

?

?

str = %q{puts "hello".length}eval str # => 5

?

?

读书人网 >操作系统

热点推荐