Hi, soweit ich weiß geht das erst ab Ruby 1.9. In 1.8 geht das aber, indem man auf yield verzeichtet und den block ganz "normal" als Proc-Object übergibt:
a = Proc.new{|text,block|
s = "ein #{text}"
block.call(s)
}
a.call("Versuch", lambda{|s| puts s})
Viele Grüße,
Till
Am 06.08.2010 um 09:26 schrieb [email protected]:
> Ich frage mich gerade, ob so etwas funktionieren kann, bzw. da es *nicht* :-(
> funktioniert, wo der Fehler liegt:
>
> a = Proc.new{|text,&block|
> s = "ein #{text}"
> yield(s)
> }
>
> a.call("Versuch"){|s| puts s}
>
> LocalJumpError: no block given
>
> Heißt das, daß das Proc-Objekt kein Block-Argument erlaubt?
> _______________________________________________
> rubyonrails-ug mailing list
> [email protected]
> http://mailman.headflash.com/listinfo/rubyonrails-ug
Till Schulte-Coerne, [email protected], http://www.innoq.com
innoQ Deutschland GmbH, Halskestr. 17, D-40880 Ratingen, Germany
Phone: +49 2102 77162-100 Mobile: +49 1515 7132845 Fax: +49 2102 77160-1
PGP.sig
Description: Signierter Teil der Nachricht
_______________________________________________ rubyonrails-ug mailing list [email protected] http://mailman.headflash.com/listinfo/rubyonrails-ug
