In this context, ?
with a character is a literal single character string. Therefore ?T
is the String "T" and puts ?T
is the same as puts "T"
You can throw it into IRB to check it out:
1.9.3p429 :002 > ?T
=> "T"
1.9.3p429 :001 > ?T.class
=> String
1.9.3p429 :003 > puts ?T
T
=> nil
Related Existing SO Questions and Answers:
Edit to add: Per a comment on the answer linked above this might have been a change in ruby 1.9 to return a single character String instead of the ASCII character value. (which the ASCII value of T is 84 )
1.9.3p429 :006 > ?T.ord
=> 84