On Sat, Nov 12, 2011 at 4:17 PM, Intransition <transfire / gmail.com> wrote:

> On Saturday, November 12, 2011 4:10:09 PM UTC-5, Quintus wrote:
>>
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> Am 12.11.2011 21:19, schrieb Intransition:
>> > Is there a way to "merge" the binding to do something like:
>> >
>> > eval('a + b', binding1 + binding2)  #=3D> 3
>>
>> Not sure if that=92s exactly what you want, but this works:
>>
>>   binding1.eval("a + binding2.eval('b')") #=3D> 3
>>
>> This is not 'merging' the two bindings, it rather opens the second
>> binding inside the first one.
>>
>
> My usecase is for template generation. For example ERB, it's render metho=
d
> takes *a* Binding.
>
>
>
>> Regarding Binding#eval, is there a specific reason why it can=92t take a
>> block instead of a string, the same way e.g. Module#instance_eval does?
>>
>
> Actually I suggested that feature on ruby issue tracker and I believe the
> anwser given was YAGNI.
>
> If it were possible could it solve this?
>
>
> I needed it once, while trying to write a tool for acceptance tests. Gave
up on it b/c this feature didn't exist.