[macruby-changes] [329] MacRuby/trunk/lib/hotcocoa/mappings.rb

source_changes at macosforge.org source_changes at macosforge.org
Mon Jul 7 22:48:41 PDT 2008


Revision: 329
          http://trac.macosforge.org/projects/ruby/changeset/329
Author:   lsansonetti at apple.com
Date:     2008-07-07 22:48:41 -0700 (Mon, 07 Jul 2008)
Log Message:
-----------
using const_defined? instead of build an array of all constants

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

Modified: MacRuby/trunk/lib/hotcocoa/mappings.rb
===================================================================
--- MacRuby/trunk/lib/hotcocoa/mappings.rb	2008-07-08 04:49:52 UTC (rev 328)
+++ MacRuby/trunk/lib/hotcocoa/mappings.rb	2008-07-08 05:48:41 UTC (rev 329)
@@ -13,7 +13,7 @@
       framework = options.delete(:framework)
       mapped_name = options.keys.first
       mapped_value = options.values.first
-      if framework.nil? || Object.constants.include?(mapped_value)
+      if framework.nil? || Object.const_defined?(mapped_value)
         m = Mapper.new(mapped_name, Object.const_get(mapped_value), &block)
         mappings[m.builder_method] = m
       else
@@ -46,4 +46,4 @@
     
   end
   
-end
\ No newline at end of file
+end
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macruby-changes/attachments/20080707/0440b3d2/attachment.html 


More information about the macruby-changes mailing list