The Ruby Craftsman
Refactoring Towards Immutable Objects in Ruby [Video]
Learn how to refactor from a mutable object into an immutable one while still being able to make changes to state. I’ll start with an Account class and show how you would let it emit new objects instead of changing the previous one. I walk step by step through the refactor process and talk about its possible advantages.
Edited 2017-12-20 to fix warnings circular argument reference
for Ruby >= 2.2