Afficher un message
Vieux 16/09/2007, 18h40   #4
Pedro Del Gallego
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: blocks expected arguments and metaprogramming

>
> On Sep 16, 8:10 am, "Pedro Del Gallego" <pedro.delgall...@gmail.com>
> wrote:
> > hi all,
> >
> > in this (http://pastie.caboo.se/97662) code :
> >
> > module Kernel
> > def expected_argument_list
> > 2
> > end
> >

> def before (name, &blk)
> puts :hola
> define_method(name){
> if blk.arity==1
> yield nly_one
> else
> yield ne,:two
> end
> }
> end
> end
>
> It's not quite as simple as that but that should be enough to move you
> forward.


Yes thats enough for me. I didnt now that the block was a Proc class.

Thanks.


--
-------------------------------------
Pedro Del Gallego

Email : pedro.delgallego@gmail.com

  Réponse avec citation
 
Page generated in 0,09319 seconds with 9 queries