Forum: Ruby-core [ruby-trunk - Feature #7614][Open] alias_accessor

Posted by Thomas Sawyer (7rans)
on 2012-12-24 03:19
(Received via mailing list)
Issue #7614 has been reported by trans (Thomas Sawyer).

----------------------------------------
Feature #7614: alias_accessor
https://bugs.ruby-lang.org/issues/7614

Author: trans (Thomas Sawyer)
Status: Open
Priority: Normal
Assignee:
Category: core
Target version: next minor


=begin
Prior issue reminded me that I've been meaning to ask for this for a 
while, as I use is fairly often.

In pure Ruby the definition is essentially:

    def alias_accessor(name, origin)
      alias_method "#{name}=", "#{origin}="
      alias_method name, origin
    end

Albeit pursuit to prior mentioned issue, I'd define it more like:

    def alias_accessor(name, origin)
      writer_name = name.to_s.chomp('?')
      alias_method "#{writer_name}=", "#{origin}="
      alias_method name, origin
    end

=end
Posted by ko1 (Koichi Sasada) (Guest)
on 2013-02-22 01:23
(Received via mailing list)
Issue #7614 has been updated by ko1 (Koichi Sasada).

Assignee set to matz (Yukihiro Matsumoto)


----------------------------------------
Feature #7614: alias_accessor
https://bugs.ruby-lang.org/issues/7614#change-36749

Author: trans (Thomas Sawyer)
Status: Open
Priority: Normal
Assignee: matz (Yukihiro Matsumoto)
Category: core
Target version: next minor


=begin
Prior issue reminded me that I've been meaning to ask for this for a 
while, as I use is fairly often.

In pure Ruby the definition is essentially:

    def alias_accessor(name, origin)
      alias_method "#{name}=", "#{origin}="
      alias_method name, origin
    end

Albeit pursuit to prior mentioned issue, I'd define it more like:

    def alias_accessor(name, origin)
      writer_name = name.to_s.chomp('?')
      alias_method "#{writer_name}=", "#{origin}="
      alias_method name, origin
    end

=end
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.