摘要: Ruby的内部类结构Array.class # => ClassClass.class # => Classsuperclass 查看父类Array.superclass # =>ObjectObject.superclass # =>BasicObjectBasicObject.superclass # => nilancestors 查看当前类的继承链Array.ancestors # => ... 阅读全文
posted @ 2018-02-18 21:28 罗道义 阅读(299) 评论(0) 推荐(0) 编辑
摘要: 继承示例# inheritanceclass User attr_accessor :name, :age def initialize name, age @name, @age = name, age end def panels # ||= 操作符, 如果变量不存在 那么就赋值 @panels ||= ['Profile', 'Products'] endendc... 阅读全文
posted @ 2018-02-18 03:13 罗道义 阅读(137) 评论(0) 推荐(0) 编辑
本站总访问量