From: andrew.kozin@... Date: 2015-06-18T15:39:46+00:00 Subject: [ruby-core:69656] [Ruby trunk - Bug #11283] Block assigned implicitly Issue #11283 has been updated by Andrew Kozin. Description updated ---------------------------------------- Bug #11283: Block assigned implicitly https://bugs.ruby-lang.org/issues/11283#change-53016 * Author: Andrew Kozin * Status: Open * Priority: Normal * Assignee: * ruby -v: 1.9.3, 2.0, 2.1, 2.2, ruby-head * Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN ---------------------------------------- That is how it works: module Test def self.build(&block) klass = Class.new(Object) klass.__send__(:define_method, :foo) klass.__send__(:define_method, :bar) klass end end Tested = Test.build { :foo } # warning: tried to create Proc object without a block # => Tested Tested.new.foo # => :foo Tested.new.bar # => :foo The block is assigned to all methods implicitly, while it wasn't asked to. The interpreter sends warning message, but doesn't raise `SyntaxError` as it IMHO should be. The behaviour is tested under MRI 1.9.3, 2.0, 2.1, 2.2, ruby-head. Exceptions are raised by Rbx and Jruby interpreters. -- https://bugs.ruby-lang.org/