Somehow, when trying to split an element in an array, split is no
longer working.
I get this error:
private method `split’ called for #Array:0xa7ad1ba4 (NoMethodError)
I can’t show the code which generates the array, but I can reproduce
the error with something simple like this:
puts [“a\nb”, “c”].split("\n")
However, imagine if you would that code like this could generate the
same private method error.
array = [“a\nb”, “c”]
puts array[0].split("\n")
(where ‘array[0]’ is an element in a slightly complex array)
Why can’t I use split with an element in my array? What’s going on
here?
I can do { puts array[0].inspect } and everything is normal…
My goal is to convert an array which has strings of varying sizes (one
or more lines) into an array where each element has just one line of
text. Maybe there’s a better way to do this and I can avoid this
wierdness?