P
Paul
Hi there, I am looking at some old, confusing ruby code that works but
is really ugly. I'm hoping someone here can help me find a more ruby
way of rewriting it. Rather than post the ugly code, I'll describe
what it is trying to do.
The code reads in each line of an array, looks for a closing/ending "
and puts multiple lines into one element of another array if they are
part of the same string.
input: data_array = [ " \"Only one line.\"", " \"line 1 ", " line 2.\"
" ]
so data_array.size = 3
----
"line 1
line 2."
----
I need to bring linked lines together like this:
new_array = [ " \"Only one line.\"", " \"line 1 line 2.\" "]
=> new_array.size = 2
ideas?
TIA.
is really ugly. I'm hoping someone here can help me find a more ruby
way of rewriting it. Rather than post the ugly code, I'll describe
what it is trying to do.
The code reads in each line of an array, looks for a closing/ending "
and puts multiple lines into one element of another array if they are
part of the same string.
input: data_array = [ " \"Only one line.\"", " \"line 1 ", " line 2.\"
" ]
so data_array.size = 3
----
"Only one line."puts data_array
"line 1
line 2."
----
I need to bring linked lines together like this:
new_array = [ " \"Only one line.\"", " \"line 1 line 2.\" "]
=> new_array.size = 2
ideas?
TIA.