Update README.md to clarify that last bit

This commit is contained in:
Marc Siegel 2018-01-16 14:46:46 -05:00 committed by GitHub
parent 1f5353a9bb
commit 1317045c10
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -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.