Is there a better way to write { yield }

Is there a better way to write something like

def meth(a,b,c)
:
:
other_meth(d) { yield }
:
:
end

That { yield } has some redundancy.

Thanks

Stephan

On May 20, 2008, at 4:58 PM, Stephan W. wrote:

That { yield } has some redundancy.

Thanks

Stephan

Posted via http://www.ruby-forum.com/.

def meth(*a, &b)
other_method(*a, &b)
end

a @ http://codeforpeople.com/

Stephan W. wrote:

That { yield } has some redundancy.
That form has the advantage, IIUC, that no Proc object is created, so
it’s a little more efficient. (Search the archives for block versus
proc.) Also, Rdoc can pick up the yield (and its arg) automatically.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs