ajsharp/bldr — pull request #27 by lafave (2013-02-19 15:41:42+00:00)
Title: Add access to instance variables from within nested blocks

**Moved from https://github.com/ajsharp/bldr/pull/26**

#### This PR
* Copies instance variables from a parent node when a new node is created that has a parent so that nested blocks have access to the instance variables.
* Not all instance variables are copied into the child's context, specifically instance variables sharing a name used in the `attr_reader` helper.

#### Gotcha
```ruby
object :user => @user do
# Raises an error unless @user has @bar as an instance variable
# since this block is instance_eval'd on current_object, which
# in this case is @user.
attribute(:bad_foo) { @bar }

# Workaround; the block is simply call'd with current_object as
# the one and only parameter which in this case we don't care
# about so can set to _.
attribute(:good_foo) { |_| @bar }
end
```

Thanks to @ajsharp for getting this started.