deep_fetch stretches my brain

OK, look at the deep_fetch gist. I’ve been puzzling this one out for a couple of hours. Finally, Das Licht ging an.

The main magic I needed was to know how Kernel#throw and Kernel#catch works; I didn’t have the right behavior for #catch. After looking it up, well, things made more sense.

Then one needs to understand Array#fetch in all three forms. The && in assignment is a very common idiom, so at least I had that correct.

After all that, you’ll be able to run through the various ways deep_fetch might work, given the examples in the gist. And it really is simple, but I’m pretty much awed to think how anyone would come up with the code from scratch.

Previous Post
Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: