J
junk5
Hi all
(I know about to_s --- that isn't what this post is about!)
Say I have an array that I create with:
a = [1, 2, [3, 4], 5]
At the irb prompt, Ruby replies:
=> [1, 2, [3, 4], 5]
So how do I get a String containing "[1, 2, [3, 4], 5]"? Doing a.to_s
gives me "12345", which is not what I want.
I need this for debugging purposes and would rather not have to write
my own array printer. It must be easy, but I can't see which function I
should use.
Thanks in advace,
C
(I know about to_s --- that isn't what this post is about!)
Say I have an array that I create with:
a = [1, 2, [3, 4], 5]
At the irb prompt, Ruby replies:
=> [1, 2, [3, 4], 5]
So how do I get a String containing "[1, 2, [3, 4], 5]"? Doing a.to_s
gives me "12345", which is not what I want.
I need this for debugging purposes and would rather not have to write
my own array printer. It must be easy, but I can't see which function I
should use.
Thanks in advace,
C