I just stumbled across this piece of code:
if source[0] != ?/
source = compute_asset_path(source, options)
end
What's this "?/
"? I've never seen writing strings this way.
$ irb
2.0.0p247 :001 > ?/
=> "/"
Apparently it works for single characters only:
2.0.0p247 :001 > ?a
=> "a"
2.0.0p247 :002 > ?foo
SyntaxError: (irb):2: syntax error, unexpected '?'
What does ?
mean?
another version of string but shorter :)
also true: %{/}
?
is used to represent single character string literals. Like?a
,?b
but not?ab
.To answer the comment of OP :
Yes, they are.
In Ruby 1.8.x series, it return ASCII value
In Ruby 1.9+ it returns same character string