Modified: MacRuby/trunk/NSString.m (3948 => 3949)
--- MacRuby/trunk/NSString.m 2010-04-21 02:29:46 UTC (rev 3948)
+++ MacRuby/trunk/NSString.m 2010-04-21 03:51:32 UTC (rev 3949)
@@ -173,14 +173,17 @@
static VALUE
nsstr_forward(id rcv, SEL sel, int argc, VALUE *argv)
{
- return rb_vm_call(nsstr_to_rstr(rcv), sel, argc, argv, false);
+ return rb_vm_call_with_cache2(rb_vm_get_call_cache(sel),
+ rb_vm_current_block(), nsstr_to_rstr(rcv), rb_cRubyString, sel, argc,
+ argv);
}
static VALUE
nsstr_forward_bang(id rcv, SEL sel, int argc, VALUE *argv)
{
VALUE rcv_rstr = nsstr_to_rstr(rcv);
- VALUE ret = rb_vm_call(rcv_rstr, sel, argc, argv, false);
+ VALUE ret = rb_vm_call_with_cache2(rb_vm_get_call_cache(sel),
+ rb_vm_current_block(), rcv_rstr, rb_cRubyString, sel, argc, argv);
[rcv setString:(id)rcv_rstr];
return ret;
}
Modified: MacRuby/trunk/spec/macruby/core/string_spec.rb (3948 => 3949)
--- MacRuby/trunk/spec/macruby/core/string_spec.rb 2010-04-21 02:29:46 UTC (rev 3948)
+++ MacRuby/trunk/spec/macruby/core/string_spec.rb 2010-04-21 03:51:32 UTC (rev 3949)
@@ -81,4 +81,8 @@
# TODO
#lambda { a << 'foo' }.should raise_error(RuntimeError)
end
+
+ it "forwards the block when calling a ruby method" do
+ NSString.stringWithString("ybuRcaM").sub(/.+/) { |s| s.reverse }.should == "MacRuby"
+ end
end