Actions
Bug #10283
closedCalling define_method with a dynamic symbol ending in = results in a NoMethodError when calling the method via assignment, until called via send
Description
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.
Updated by nobu (Nobuyoshi Nakada) about 10 years ago
- Related to Bug #10266: String#to_sym generates too big object_id? added
Updated by nobu (Nobuyoshi Nakada) about 10 years ago
- Related to deleted (Bug #10266: String#to_sym generates too big object_id?)
Updated by nobu (Nobuyoshi Nakada) about 10 years ago
- Related to Bug #10259: send を使った attr_writer への書き込みができない場合がある added
Updated by nobu (Nobuyoshi Nakada) about 10 years ago
- Description updated (diff)
- Status changed from Open to Closed
- Backport changed from 2.0.0: UNKNOWN, 2.1: UNKNOWN to 2.0.0: DONTNEED, 2.1: DONTNEED
Updated by nobu (Nobuyoshi Nakada) about 10 years ago
- Has duplicate Bug #10299: alias_method :new_foo=, :"#{:foo}=" doesn't work properly on ruby 2.2.0preview1. added
Actions
Like0
Like0Like0Like0Like0Like0