Revision
624
Author
rich@infoether.com
Date
2008-09-26 09:39:27 -0700 (Fri, 26 Sep 2008)

Log Message

allow mapping to a class name not just a symbol

Modified Paths

Diff

Modified: MacRuby/trunk/lib/hotcocoa/delegate_builder.rb (623 => 624)


--- MacRuby/trunk/lib/hotcocoa/delegate_builder.rb	2008-09-26 05:11:32 UTC (rev 623)
+++ MacRuby/trunk/lib/hotcocoa/delegate_builder.rb	2008-09-26 16:39:27 UTC (rev 624)
@@ -12,7 +12,7 @@
     end
     
     def add_delegated_method(block, selector_name, *parameters)
-      clear_delegate
+      clear_delegate if required_methods.empty?
       increment_method_count
       bind_block_to_delegate_instance_variable(block)
       create_delegate_method(selector_name, parameters)

Modified: MacRuby/trunk/lib/hotcocoa/mappings.rb (623 => 624)


--- MacRuby/trunk/lib/hotcocoa/mappings.rb	2008-09-26 05:11:32 UTC (rev 623)
+++ MacRuby/trunk/lib/hotcocoa/mappings.rb	2008-09-26 16:39:27 UTC (rev 624)
@@ -30,7 +30,10 @@
       framework = options.delete(:framework)
       mapped_name = options.keys.first
       mapped_value = options.values.first
-      if framework.nil? || Object.const_defined?(mapped_value)
+      if mapped_value.kind_of?(Class)
+        m = Mapper.map_instances_of(mapped_value, mapped_name, &block)
+        mappings[m.builder_method] = m
+      elsif framework.nil? || Object.const_defined?(mapped_value)
         m = Mapper.map_instances_of(Object.const_get(mapped_value), mapped_name, &block)
         mappings[m.builder_method] = m
       else