Sha256: 70ec8c9404525d76f3a79f6567754a5ce897c52cfe3546e7a41196e1be30d0f6
Contents?: true
Size: 1.03 KB
Versions: 61
Compression:
Stored size: 1.03 KB
Contents
controller :controller do action :index do on_entry %{ original_page = { _head: "head", _next: "next", _id: "id", _type: "array", entries: [ {_id: "id1", _sig: "sig1"}, {_id: "id2", _sig: "sig2"}, ], _hash: "hash", }; //Now we make a new copy page = CopyPage(original_page); var a = EntryMutable(page, 0); var b = EntryMutable(page, 1); a.hello = "world"; b.hello = "world"; //This is a violation of the vm, it will set the original but not copied //This is because the page.entries[1] actually refers to the original_page.entries[1] //the array of original_page.entries belongs to original_page, but the entries inside it //are references. When you call entrymutable, you are making a copy and replacing that //entry in the array so that page.entries[0] is actually owned by page and is no longer apart //of original_page original_page.entries[0].foo = "bar"; } end end
Version data entries
61 entries across 61 versions & 1 rubygems