Re: #send

[email protected]
Newsgroups gmane.comp.lang.ruby.german
Message-ID <[email protected]>
Hello --

On Wed, 28 Aug 2002, Tobias Huesgen wrote:

> Hallo!
>
> Habs jetzt so:
>
> @model_data.each do |e|
>             if e[1] != nil
>                 i = e[1]["args"];
>                 case (i.length)
>                     when 1
>                         GL.send(e[0],i[0]);
>                     when 2
>                         GL.send(e[0],i[0],i[1]);
>                     when 3
>                         GL.send(e[0],i[0],i[1],i[2]);
>                     when 4
>                         GL.send(e[0],i[0],i[1],i[2],i[3]);
>                 end;
>             else
>                 GL.send(e[0]);
>             end;
>         end;
> Ist zwar nicht das, was ich wollte, aber hautpsache es ist (scheinbar)
> schneller als eval :)

Warum nicht etwa:

  @model_data.each do |e|
    args = if e[1] then e[1]["args"] else [] end
    GL.send(e[0],*args)
  end


David

-- 
David Alan Black
home: [email protected]
work: [email protected]
Web:  http://pirate.shu.edu/~blackdav
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.