Nevermind. The problem is not related to the string class, I'm just dumb and 
didn't realize I created a literal array.


Mark Rada
mr...@marketcircle.com



On 2011-04-07, at 12:12 AM, Mark Rada wrote:

> I've got a strange behaviour during string comparison that boils down to the 
> following:
> 
> 
>       class NSString
>         def predicate?
>           [-1] == '?'
>         end
>       end
> 
>       puts '?'.predicate? # => false
>       puts '?'[-1]               # => "?"
>       puts '?'[-1] == '?'    # => true
> 
> 
> I'm not sure if this is a known side effect of how Strings are implemented 
> now or if it is simply a bug.
> 
> I know it will work if I use a regexp, but this method is less code and 
> faster.
> 
> Thoughts?
> 
> 
> Thanks,
> 
> Mark Rada
> mr...@marketcircle.com
> 
> _______________________________________________
> MacRuby-devel mailing list
> MacRuby-devel@lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

_______________________________________________
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

Reply via email to