Refining Ruby

1 · Charles Oliver Nutter · Nov. 19, 2012, 2:38 p.m.
What does the following code do? If you answered "it upcases two strings and adds them together, returning the result" you might be wrong because of a new Ruby feature called "refinements".Let's start with the problem refinements are supposed to solve: monkey-patching.Monkey-patchingIn Ruby, all classes are mutable. Indeed, when you define a new class, you're really just creating an empty class and filling it with methods. The ability to mutate classes at runtime has been used (or abused) by man...