On Thu, Jun 10, 2010 at 12:38 AM, Intransition <transfire / gmail.com> wrote:
> Why is #binding a private method? I end up doing a lot of this:
>
>   >   >  
>  
>  
>
> In order to setup a scope for ERB evaluation, among other uses.

I can think of two potential reasons.

1. Because binding exposes the internals of the receiver.

2. because if it were public then in a case like:


class A
    def self.binding_of(b)
        b.binding
    end
end

A.binding_of("abc")

might well return a binding with self == A, rather than the string,
because binding returns the bindings "at the point of call"


-- 
Rick DeNatale

Blog: http://talklikeaduck.denhaven2.com/
Github: http://github.com/rubyredrick
Twitter: @RickDeNatale
WWR: http://www.workingwithrails.com/person/9021-rick-denatale
LinkedIn: http://www.linkedin.com/in/rickdenatale