StringIO

Hello,

I have to apologize if there is an obvious answer to my issue - we were
all beginners once …

I have just started playing with ruby couple days ago.

My problem is: when I run the script (in SciTe) instead of seeing the
result, I see only a referrence like this:
#StringIO:0x2c62364

then the script exits.
I know the return must be quite a long list but I can’t see it.
I’ve searched the Internet hoping to understand what this output is; I
came to understand something but it is definitely not enough to help me
see the output.

How can I see the content of this StringIO?

this is my script:

require ‘rubygems’
require ‘spectools’
require ‘vnmsh’

SpecTools::Config.default_access_method = :cli
session = VNMSH.new()
session.connect
VNMSH.default_session = session
models = SpecTools::Model.find({:name, ‘1A2’}).first
IP_addr = Attr.new()
IP_addr.id = ‘0x12d7f’
tt = session.show_attributes(:model, models, {:name,“Condition”})
puts tt

Thank you very much,

Eugen Naiman wrote:

then the script exits.
I know the return must be quite a long list but I can’t see it.
I’ve searched the Internet hoping to understand what this output is; I
came to understand something but it is definitely not enough to help me
see the output.

How can I see the content of this StringIO?

StringIO#string will give you the underlying StringIO content. Here’s
output from my irb session:

$ irb

StringIO.new(‘asdfasdf’).string
=> “asdfasdf”

You should also check out the StringIO docs:

http://ruby-doc.org/stdlib/libdoc/stringio/rdoc/index.html

Aaron P. wrote:

StringIO#string will give you the underlying StringIO content. Here’s
output from my irb session:

$ irb

StringIO.new(‘asdfasdf’).string
=> “asdfasdf”

You should also check out the StringIO docs:

http://ruby-doc.org/stdlib/libdoc/stringio/rdoc/index.html

Thank you,

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs