From: "rkh (Konstantin Haase)" Date: 2013-04-13T00:43:38+09:00 Subject: [ruby-core:54230] [ruby-trunk - Feature #7872] `block_given?` does not work inside `define_method` Issue #7872 has been updated by rkh (Konstantin Haase). Rebinding block_given? on define_method might be confusing, as the block might be passed to an API without the user being aware of it being used with define_method. ---------------------------------------- Feature #7872: `block_given?` does not work inside `define_method` https://bugs.ruby-lang.org/issues/7872#change-38495 Author: alexeymuranov (Alexey Muranov) Status: Open Priority: Normal Assignee: matz (Yukihiro Matsumoto) Category: core Target version: next minor =begin Is this the expected behavior? define_method :try do block_given? ? yield : 'no block' end try { 'block' } # => "no block" However: def try_again block_given? ? yield : 'no block' end try_again { 'block' } # => "block" =end -- http://bugs.ruby-lang.org/