From: nobu@... Date: 2014-09-23T00:29:29+00:00 Subject: [ruby-core:65227] [ruby-trunk - Bug #10283] Calling define_method with a dynamic symbol ending in = results in a NoMethodError when calling the method via assignment, until called via send Issue #10283 has been updated by Nobuyoshi Nakada. Related to deleted (Bug #10266: String#to_sym generates too big object_id?) ---------------------------------------- Bug #10283: Calling define_method with a dynamic symbol ending in = results in a NoMethodError when calling the method via assignment, until called via send https://bugs.ruby-lang.org/issues/10283#change-49058 * Author: Jeremy Evans * Status: Open * Priority: Normal * Assignee: * Category: * Target version: current: 2.2.0 * ruby -v: ruby 2.2.0preview1 (2014-09-17 trunk 47616) [i386-openbsd] * Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN ---------------------------------------- This raises a NoMethodError in ruby 2.2.0preview1: ruby -e "class A; define_method('b='.to_sym){|v|}; end; A.new.b = 1" This does not, showing it is specific to dynamic symbols: ruby -e "class A; define_method(:b=){|v|}; end; A.new.b = 1" This does not, showing it is specific to symbols ending in =: ruby -e "class A; define_method('b'.to_sym){}; end; A.new.b" This does not, showing it works when called via send: ruby -e "class A; define_method('b='.to_sym){|v|}; end; A.new.send(:b=, 1)" This does not, showing it works after calling send: ruby -e "class A; define_method('b='.to_sym){|v|}; end; A.new.send(:b=, 1); A.new.b = 1" I apologize if this is already fixed in trunk. -- https://bugs.ruby-lang.org/