From 514e3a409c5d57086e306511210272d089b53582 Mon Sep 17 00:00:00 2001 From: Marc Siegel Date: Mon, 29 Jul 2013 03:07:41 -0400 Subject: [PATCH] Clarify example of immutable DSL object in README --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 46716b3..7477a1b 100644 --- a/README.md +++ b/README.md @@ -166,11 +166,16 @@ order to enforce [immutability](http://en.wikipedia.org/wiki/Immutable_object). Wouldn't it be great if we could just treat these methods as a DSL as well? ```ruby -with_immutable_string("I'm immutable!".freeze) do +s = "I'm immutable!".freeze + +with_immutable_string(s) do reverse upcase end #=> "!ELBATUMMI M'I" + +s +#=> "I'm immutable!" ``` No problem, just define the method `with_immutable_string` like this: