On Thu, Mar 12, 2015 at 6:19 PM, Esteban A. Maringolo <emaring...@gmail.com> wrote:
> 2015-03-12 17:22 GMT-03:00 Mariano Martinez Peck <marianop...@gmail.com>: > > On Thu, Mar 12, 2015 at 5:16 PM, Esteban A. Maringolo < > emaring...@gmail.com> > > wrote: > > >> Assuming you store the original JSON string as a String object in an > >> instance variable named "json" you could map it as any other string. > > > But how do I get the JSON string associated to the TestObject instance? > In > > other words... > > Why doesn't this work? > > mapper for: TestObject do: [ :mapping | > "..." > (mapping mapInstVar: #jsonOriginalString) > ]. > > Because that would do nothing..that would let jsonOriginalString in nil. > That would make sense if the jsonOriginalString is an immutable object > (from the application standpoint) that you keep in order to preserve > some sort of logging of how/where the object was created. > > Yes, exactly. This is one of the reasons. Cheers, -- Mariano http://marianopeck.wordpress.com