Project

General

Profile

Actions

Bug #10299

closed

alias_method :new_foo=, :"#{:foo}=" doesn't work properly on ruby 2.2.0preview1.

Added by hbd225 (Norimasa Ando) about 10 years ago. Updated about 10 years ago.

Status:
Closed
Assignee:
-
Target version:
ruby -v:
ruby 2.2.0preview1 (2014-09-17 trunk 47616) [x86_64-darwin12.0]
[ruby-core:65290]

Description

Here is reproducible script.

class Test
  class << self
    def test
      alias_method :new_foo=, :"#{:foo}="
    end
  end
  attr_accessor :foo
  test
end

It occurs following error.

NameError: undefined method `foo=' for class `Test'
from /Users/ando_norimasa/a.rb:4:in `alias_method'

I expect it works without error.


Related issues 2 (0 open2 closed)

Is duplicate of Ruby master - Bug #10259: send を使った attr_writer への書き込みができない場合があるClosed09/18/2014Actions
Is duplicate of Ruby master - Bug #10283: Calling define_method with a dynamic symbol ending in = results in a NoMethodError when calling the method via assignment, until called via sendClosed09/22/2014Actions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0