On Thu, Feb 17, 2011 at 3:17 PM, Luke Kanies <[email protected]> wrote:

> luke@syringe $ ruby -e 'a = "foo"; b = -a'
> -e:1: undefined method `-@' for "foo":String (NoMethodError)
> luke@syringe $
>
>
Yes, but this error doesn't come from Ruby's parser.  It is a runtime error
at the time that Ruby detects that you are trying to apply unary minus to a
string.  Ruby allows unary negation of variables that hold numeric values:

[ticket/2.6.next/6338] ~/puppet_labs/puppet$ ruby -e 'a = 3; b = -a; puts b'
-3
[ticket/2.6.next/6338] ~/puppet_labs/puppet$

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en.

Reply via email to