[MacRuby] #1433: Defining valueForUndefinedKey after an NSUnknownKeyException has been raised fails

MacRuby ruby-noreply at macosforge.org
Wed Dec 28 08:48:38 PST 2011


#1433: Defining valueForUndefinedKey after an NSUnknownKeyException has been
raised fails
-----------------------------------+----------------------------------------
 Reporter:  ndh@…                  |       Owner:  lsansonetti@…        
     Type:  defect                 |      Status:  new                  
 Priority:  minor                  |   Milestone:                       
Component:  MacRuby                |    Keywords:                       
-----------------------------------+----------------------------------------

Comment(by ndh@…):

 Forgot to wiki format the code.

 {{{

 class Foo
   attr_accessor :bar
 end

 foo = Foo.new
 foo.bar = 'baz'

 begin
   foo.valueForKey("qux")
 rescue => e
   puts e
 end

 class Foo
   def valueForUndefinedKey(key)
     p "#{self}::valueForUndefinedKey(#{key})"
   end
 end
 p foo.valueForKey("qux")
 }}}

 I also discovered that {{{setValue:forUndefinedKey:}}} has the same
 behavior.

-- 
Ticket URL: <http://www.macruby.org/trac/ticket/1433#comment:1>
MacRuby <http://macruby.org/>



More information about the macruby-tickets mailing list