From 1317045c106fccb46fb5500db455da3a7a437a17 Mon Sep 17 00:00:00 2001 From: Marc Siegel Date: Tue, 16 Jan 2018 14:46:46 -0500 Subject: [PATCH] Update README.md to clarify that last bit --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3a8b56c..03a8523 100644 --- a/README.md +++ b/README.md @@ -54,8 +54,10 @@ end Good question! -In short, **no** you can't, if you want to be able to refer anything -the block would normally have captured from the surrounding context. +In short: **No**. + +Not if you want the code in the block to be able to refer to anything +the block would normally have access to from the surrounding context. Let's be very specific. Docile internally uses `instance_exec` (see [execution.rb#25](lib/docile/execution.rb#L25)), adding a small layer to support referencing *local variables*, *instance variables*, and *methods* from the _block's context_ **or** the target _object's context_, interchangeably. This is "the **hard part**", where most folks making a DSL in Ruby throw up their hands.