
Eloquent Ruby (Addison-Wesley Professional Ruby Series)

A Ruby module is the container part of a class without the factory.
Russ Olsen • Eloquent Ruby (Addison-Wesley Professional Ruby Series)
This simple “bury the details in a method that takes a block” technique goes by the name of execute around.
Russ Olsen • Eloquent Ruby (Addison-Wesley Professional Ruby Series)
Any given class, say, Document, is an instance of Class. This means that it inherits all kinds of methods from Class, methods like name and superclass. When we want to add a class method, we want that new method to exist only on the one class (Document in the example), not on all classes. Since the object that goes by the name of Document is an ins
... See moreRuss Olsen • Eloquent Ruby (Addison-Wesley Professional Ruby Series)
As long as you follow the hash Prime Directive—that if a.eql?(b) then a.hash == b.hash—you are free to override these two methods.
Russ Olsen • Eloquent Ruby (Addison-Wesley Professional Ruby Series)
Lesson one is that if you are calling a method that takes a block, pause for a second before you put a return, next, or break in that block. Does it make sense here? Lesson two is that if you want a block object that behaves like the ones that Ruby generates when you pass a couple of braces into a method, use Proc.new. If you want something that wi
... See moreRuss Olsen • Eloquent Ruby (Addison-Wesley Professional Ruby Series)
Sorry, we’re unable to display this type of content.