[macruby-changes] [624] MacRuby/trunk/lib/hotcocoa
source_changes at macosforge.org
source_changes at macosforge.org
Fri Sep 26 09:39:28 PDT 2008
Revision: 624
http://trac.macosforge.org/projects/ruby/changeset/624
Author: rich at 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:
--------------
MacRuby/trunk/lib/hotcocoa/delegate_builder.rb
MacRuby/trunk/lib/hotcocoa/mappings.rb
Modified: MacRuby/trunk/lib/hotcocoa/delegate_builder.rb
===================================================================
--- 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
===================================================================
--- 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macruby-changes/attachments/20080926/6de3dffe/attachment.html
More information about the macruby-changes
mailing list