Projects

Ticket #40 (closed enhancement: fixed)

Opened 4 years ago

Last modified 3 years ago

Create KVC-compliant setter when using attr_accessor.

Reported by: alloye@… Owned by: lsansonetti@…
Priority: major Milestone: MacRuby 0.3
Component: MacRuby Keywords:
Cc:

Description

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

Change History

Changed 4 years ago by lsansonetti@…

You're right, I was thinking the same thing a while ago. This would also eliminate the need of the ib_outlet method.

Changed 3 years ago by lsansonetti@…

  • status changed from new to closed
  • resolution set to fixed
  • milestone changed from MacRuby 1.0 to MacRuby 0.3

Fixed in r526/trunk.

attr_writer/attr_accessor now generates a KVC-compliant setter. ib_outlet has been deprecated.

Note: See TracTickets for help on using tickets.