# StringIO

**URL:** <https://www.ruby-forum.com/t/stringio/177542>\
**Category:** Ruby\
**Created:** [October 20, 2009, 12:56am UTC](https://www.ruby-forum.com/t/stringio/177542 "2009-10-20T00:56:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![enaiman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/ad7895/32.png) [@enaiman](https://www.ruby-forum.com/u/enaiman)\
**Post date:** [October 20, 2009, 12:56am UTC](https://www.ruby-forum.com/t/stringio/177542/1 "2009-10-20T00:56:37Z")

</div>

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,

---

<div class="post-metadata">

**Author:** ![enaiman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/ad7895/32.png) [@enaiman](https://www.ruby-forum.com/u/enaiman)\
**Post date:** [October 20, 2009, 2:18am UTC](https://www.ruby-forum.com/t/stringio/177542/2 "2009-10-20T02:18:09Z")

</div>

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](http://ruby-doc.org/stdlib/libdoc/stringio/rdoc/index.html)

---

<div class="post-metadata">

**Author:** ![enaiman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/ad7895/32.png) [@enaiman](https://www.ruby-forum.com/u/enaiman)\
**Post date:** [October 20, 2009, 2:26am UTC](https://www.ruby-forum.com/t/stringio/177542/3 "2009-10-20T02:26:41Z")

</div>

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](http://ruby-doc.org/stdlib/libdoc/stringio/rdoc/index.html)

Thank you,
