From: "marcandre (Marc-Andre Lafortune)" Date: 2013-04-19T02:22:07+09:00 Subject: [ruby-core:54435] [ruby-trunk - Feature #8262][Closed] Confusing "undefined method" exception when using - operator on a string Issue #8262 has been updated by marcandre (Marc-Andre Lafortune). Status changed from Open to Closed Perfect. I'll close this then, unless someone comes up with a better proposal. ---------------------------------------- Feature #8262: Confusing "undefined method" exception when using - operator on a string https://bugs.ruby-lang.org/issues/8262#change-38713 Author: ajack (Jack Weeden) Status: Closed Priority: Normal Assignee: Category: core Target version: When trying to use the minus operator (-) on a String, Ruby reports the following exception: > -"5" > NoMethodError: undefined method `-@' for "5":String I'm not sure if this is intended behaviour but it was confusing as it led me to believe I was trying to call `-@"5"` rather than `-"5"` (I realise the minus operator is invalid for a String but I was looking all over for somewhere I'd accidentally typed in an "@" symbol, rather than somewhere I was just trying to call `-"5"`) Applies to Ruby 1.8.7, 1.9.3 and 2.0.0 -- http://bugs.ruby-lang.org/