[macruby-changes] [331] MacRuby/trunk/lib/hotcocoa/mapper.rb

source_changes at macosforge.org source_changes at macosforge.org
Tue Jul 8 05:41:28 PDT 2008


Revision: 331
          http://trac.macosforge.org/projects/ruby/changeset/331
Author:   rich at infoether.com
Date:     2008-07-08 05:41:27 -0700 (Tue, 08 Jul 2008)
Log Message:
-----------
fixed per laurent to enable empty arguments and use respondsToSelector rather than responds_to? to check for sizeToFit

Modified Paths:
--------------
    MacRuby/trunk/lib/hotcocoa/mapper.rb

Modified: MacRuby/trunk/lib/hotcocoa/mapper.rb
===================================================================
--- MacRuby/trunk/lib/hotcocoa/mapper.rb	2008-07-08 07:21:35 UTC (rev 330)
+++ MacRuby/trunk/lib/hotcocoa/mapper.rb	2008-07-08 12:41:27 UTC (rev 331)
@@ -13,7 +13,7 @@
       @control_module = mod
       inst = self
       HotCocoa.send(:define_method, builder_method) do |*args, &control_block|
-        map = args.length == 1 ? args[0] : args[1]
+        map = (args.length == 1 ? args[0] : args[1]) || {}
         guid = args.length == 1 ? nil : args[0]
         map = inst.remap_constants(map)
         default_empty_rect_used = (map[:frame].__id__ == DefaultEmptyRect.__id__)
@@ -28,7 +28,7 @@
           end
         end
         if default_empty_rect_used
-          control.sizeToFit
+          control.sizeToFit if control.respondsToSelector(:sizeToFit) == 1
         end
         control_block.call(control) if control_block
         control
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macruby-changes/attachments/20080708/aac3c176/attachment.html 


More information about the macruby-changes mailing list