A cual comment te referís exactamente?

On 6/3/07, Federico Brubacher <[EMAIL PROTECTED]> wrote:

El otro dia metiendole un poco para mejorar mis skills en Ruby me cruce
con instance_eval , q segun lo q veo de Programming Ruby :
Evaluates a string containing Ruby source code, or the given block, within
the context of the receiver (*obj*). In order to set the context, the
variable self is set to *obj* while the code is executing, giving the code
access to *obj*'s instance variables.

Segun lo q estoy entendiendo cuando hacemos instance_eval de un string,
accedemos al contexto self de la clase que invoca el instance_eval y podemos
por ejemplo acceder a sus propiedades ( o cambiarlas dentro del string
instance_eval).

Tambiene estube chequando creo q es el blog de Why ? [1]  y en los
comments hacen un par de cosas interesantes con arrays dentro del
instance_eval
pero no entendi xq usan send?

O sea :
estoy en lo correcto con instance_eval?
para que sirve cuando le pasamos un bloque?
porque usar send en los ejemplitos esos ?

Arggg me estoy volviend loco !! :)

gracias y saludos


[1] http://redhanded.hobix.com/inspect/testingDeeplyWithInstance_eval.html

--
Federico Brubacher
www.fbrubacher.com

Colonial Duty Free Shop
www.colonial.com.uy
_______________________________________________
ruby mailing list
[email protected]
http://lista.rubyargentina.com.ar/listinfo.cgi/ruby-rubyargentina.com.ar




--
Pedro   Visintin .  I T   S o l u t i o n s   A r c h i t e c t
Ruby On Rails Argentina. http://blogs.onrails.com.ar
Personal page:
http://www.p-e-t-e-r-p-u-n-k.com.ar
_______________________________________________
ruby mailing list
[email protected]
http://lista.rubyargentina.com.ar/listinfo.cgi/ruby-rubyargentina.com.ar

Responder a