Creating a StringIO object

Hi all, can any body tell me how to create a StringIO object from an
existing string object.

my code str = StringIO.new results an error saying that
"uninitialized constant StringIO(NameError)"

What i sthe problem with the above code

···

--
Posted via http://www.ruby-forum.com/.

You need to load the StringIO library:

irb(main):001:0> str = StringIO.new
NameError: uninitialized constant StringIO
        from (irb):1
irb(main):002:0> require 'stringio'
=> true
irb(main):003:0> str = StringIO.new
=> #<StringIO:0xb7ce6c6c>
irb(main):004:0>

HTH,

Felix

···

-----Original Message-----
From: list-bounce@example.com
[mailto:list-bounce@example.com] On Behalf Of Venkat Bagam
Sent: Wednesday, October 03, 2007 3:37 AM
To: ruby-talk ML
Subject: creating a StringIO object

Hi all, can any body tell me how to create a StringIO object from an
existing string object.

my code str = StringIO.new results an error saying that
"uninitialized constant StringIO(NameError)"

What i sthe problem with the above code
--
Posted via http://www.ruby-forum.com/\.

You have to require the stringio library
require 'stringio'

···

On Oct 3, 5:37 am, Venkat Bagam <bagam_ven...@hotmail.com> wrote:

Hi all, can any body tell me how to create a StringIO object from an
existing string object.

my code str = StringIO.new results an error saying that
"uninitialized constant StringIO(NameError)"

What i sthe problem with the above code
--
Posted viahttp://www.ruby-forum.com/.