[MacRuby-devel] [ruby] #40: Create KVC-compliant setter when using attr_accessor.
ruby
ruby-noreply at macosforge.org
Sun Mar 23 13:13:22 PDT 2008
#40: Create KVC-compliant setter when using attr_accessor.
----------------------------+-----------------------------------------------
Reporter: alloye at mac.com | Owner: lsansonetti at apple.com
Type: enhancement | Status: new
Priority: major | Milestone: MacRuby 1.0
Component: MacRuby | Keywords:
----------------------------+-----------------------------------------------
When using attr_accessor, a KVC-compliant setter method is not registered.
Adding this feature would allow Ruby classes to be defined using the same
semantics as Objective-C 2.0 classes that employ synthesized properties.
{{{
[~]: irb
>> framework "Cocoa"
=> true
>> class Person
>> attr_accessor :name
>> def initialize(name="")
>> @name = name
>> end
>> end
=> nil
>> p = Person.new("Wayne Steele")
=> #<Person:0x1847180 @name="Wayne Steele">
>> p.respond_to?("name=")
=> true
>> p.respond_to?("setName:")
=> false
}}}
--
Ticket URL: <http://trac.macosforge.org/projects/ruby/ticket/40>
ruby <http://ruby.macosforge.org/>
More information about the MacRuby-devel
mailing list