[MacRuby-devel] When is a String not an NSString?
Michael Jackson
mjijackson at gmail.com
Tue Jul 13 10:59:40 PDT 2010
This sounds like a bug to me. Have you filed a ticket?
http://trac.macosforge.org/projects/ruby/newticket
--
Michael Jackson
http://mjijackson.com
@mjijackson
On Mon, Jul 12, 2010 at 6:02 PM, Henry Maddocks
<henry.maddocks at gmail.com> wrote:
> With respect to the following code
>
> 1 require 'test/unit'
> 2
> 3 class String
> 4 def my_method
> 5 "My Method " + self
> 6 end
> 7 end
> 8
> 9 class Test_Tumblr < Test::Unit::TestCase
> 10
> 11 def test_strings
> 12 cocoa_string = NSString::stringWithString("blah")
> 13 ruby_string = "Ruby String"
> 14
> 15 assert_equal String, cocoa_string.class
> 16 assert_equal String, ruby_string.class
> 17 assert_equal cocoa_string.class, ruby_string.class
> 18
> 19 assert ruby_string.respond_to?(:my_method), "ruby_string.respond_to?"
> 20 assert cocoa_string.respond_to?(:my_method), "cocoa_string.respond_to?"
> 21 end
> 22
> 23 end
>
>
> What is the expected result of line 20?
>
> On the one hand cocoa_string is an NSString so the monkey patch shouldn't have any effect, but on the other cocoa_string is claiming to be a ruby String.
>
> Henry
> _______________________________________________
> MacRuby-devel mailing list
> MacRuby-devel at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
More information about the MacRuby-devel
mailing list