I use Array.to_s convert to string. Ruby 1.9.0 return like [["sample
string"]], but 1.8.6 return only the value.
How to resolve this problem? I really don't want to revise so many lines
of code.
you can define your own version of Array#to_s which emulates the behaviour
of Ruby 1.8
class Array
def to_s
...your code here...
end
end
-Thomas
ยทยทยท
On 01/02/2008, Rk Ch <rollingwoods@gmail.com> wrote:
I use Array.to_s convert to string. Ruby 1.9.0 return like [["sample
string"]], but 1.8.6 return only the value.
How to resolve this problem? I really don't want to revise so many lines
of code.
I use Array.to_s convert to string. Ruby 1.9.0 return like [["sample
string"]], but 1.8.6 return only the value.
How to resolve this problem? I really don't want to revise so many lines
of code.
One option is to switch to Array#join, which also works for nested arrays:
I use Array.to_s convert to string. Ruby 1.9.0 return like [["sample
string"]], but 1.8.6 return only the value.
How to resolve this problem? I really don't want to revise so many lines
of code.