Stefano Crocco
11/8/2008 8:17:00 PM
Alle Saturday 08 November 2008, Carter Davis ha scritto:
> whenever I use
> puts to output a string, the string is in quotes.
...
> I'll type in, for example,
>
> p "You see a glass cup, and there is a door NORTH.\n There is also a
> long hallway SOUTH."
>
You aren't using puts, you're using p, which is a different thing. puts calls
to_s on its arguments, while p calls inspect. In the case of strings, to_s
gives a human-readable text, while inspect returns a version with all special
characters escaped. For example:
s = "You see a glass cup, and there is a door NORTH.\n There is also a
long hallway SOUTH."
s.to_s
gives
You see a glass cup, and there is a door NORTH.
There is also a long hallway SOUTH.
while
s.inspect
gives
"You see a glass cup, and there is a door NORTH.\n There is also along hallway
SOUTH."
which is want you get. Replace p with puts and it should work as you want.
I hope this helps
Stefano