摘要:
The boss's mission: 写一个类宏,功能与attr_accessor类似,但会创建经过校验的属性,名字attr_checked。 需求: A Development Plan: 开发计划: 第一步 创建2个拟态方法,读/写 方法。在写方法加入校验属性值是否nil/false. req 阅读全文
摘要:
Code That Writes Code 6.1 Coding your way to the weekend 6.2 Kernel#eval, Binding#eval Binding: Objects of class Binding(类Binding的对象) encapsulate (密封) 阅读全文
摘要:
在本章我遇到了c语言的struct数据,即自定义的数据结构。比如: struct edge { int u; int v; int w; }; 题目给了一组数据,用edge储存。需要按照w大小排序。我开始不知道如何用ruby实现,后来想到之前的题目也遇到过(小猫钓鱼)。我定义了一个类,在类中储存了数 阅读全文