einen seltsamen Fall kommen sah, um herauszufinden, was hier geschieht:Block Syntax Unterschied verursacht "LocalJumpError: kein Block gegeben (Ausbeute)"
> def test
> p yield
> end
=> nil
> test { 1 }
1
=> 1
> p test { 1 }
1
1
=> 1
> p test do
> 1
> end
LocalJumpError: no block given (yield)
ist die Antwort ... http://stackoverflow.com/questions/533008/what-is-the-difference-or-value-of-these-block-coding-styles-in-ruby/533040# 533.040 –
hier ist die Antwort - http://stackoverflow.com/questions/2122380/using-do-block-vs-brackets?lq=1 –
diesem Grund sollten Sie Klammern verwenden, obwohl Rubin können Sie wählen. – Linuxios