I saw this operator in HAML code. I wonder what it is for.
I see the following works:
> ?{
=> \"{\"
> ?\\s
=> \" \"
> ?a
=> \"a\"
It's not an operator, it's a character literal. However, there is no character type in Ruby, so instead of an instance of a character type the character literal evaluates to the "default representation of a character". In Ruby 1.9+, that's a String
of length 1, in Ruby 1.8, it's a Fixnum
denoting the Unicode codepoint of the character.