On Mar 6, 2012, at 12:23 PM, Dave Aronson wrote:

> On Tue, Mar 6, 2012 at 13:41, Craig White <[email protected]> wrote:
> 
>> Each ip address was put onto a new line because of the '\n' like this:
>> 10.200.0.100
>> 208.100.300.100
>> 
>> but when running on 1.9.3-p125 the text_area shows the array
>> with all of it's raw markup like this:
>> ["10.200.0.100\n", "208.100.300.100\n"]
>> 
>> I've done various things such as flattening, joining, etc. the
>> hostipnumbers_columnized but it appears impossible to get them to
>> display on individual lines in ruby-1.9.3 - without even considering
>> code that will work equally as well with 1.8.7
>> 
>> Any suggestions?
> 
> join() seems to work fine for making the string suitable:
> 
> $ irb
> ruby-1.9.3-head :001 > x = ["10.200.0.100\n", "208.100.300.100\n"]
> => ["10.200.0.100\n", "208.100.300.100\n"]
> ruby-1.9.3-head :002 > x.join
> => "10.200.0.100\n208.100.300.100\n"
> ruby-1.9.3-head :003 > puts x.join
> 10.200.0.100
> 208.100.300.100
> => nil
> ruby-1.9.3-head :004 > ^D
> 
> Would it cause problems elsewhere if hostipnumbers_columnized were to
> return results.join?  What do you get in the text_area if you do that?
----
.join("\r\n") did the trick. Needed to use double quotes and not single quotes 
(don't understand why).

Thanks... actually just stumbled onto this and was going back to my e-mail 
program to give it the old Roseanne Rosannadanna and saw your suggestion and 
the answer is yes (above)

Thanks

Craig

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to