Bug #10259
closed
send を使った attr_writer への書き込みができない場合がある
Added by mtsmfm (Fumiaki Matsushima) about 10 years ago.
Updated about 10 years ago.
Description
class Hoge; attr_writer :a; end
Hoge.new.send(:"#{:a}=", 1)
# => 1 (ruby 2.1.2)
# hoge.rb:3:in `<main>': undefined method `a=' (ruby 2.2.0-preview1)
ruby 2.2.0dev (2014-09-19 trunk 47640) [x86_64-linux] でも
ruby 2.2.0-preview1 同様に例外が発生することを確認しました。
- Status changed from Open to Closed
- % Done changed from 0 to 100
Applied in changeset r47643.
symbol.c: fix dynamic attrset ID
- symbol.c (rb_str_dynamic_intern): check if the stem ID of
attrset ID is already registered as a static ID.
[ruby-dev:48559] [Bug #10259]
- Related to 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 added
- Has duplicate Bug #10299: alias_method :new_foo=, :"#{:foo}=" doesn't work properly on ruby 2.2.0preview1. added
Also available in: Atom
PDF
Like0
Like0Like0Like0Like0