Ruby newbie here. I'm trying out Ruby 1.9.2 on Windows (RubyInstaller)
and encountered
some strangeness in using the IO class.

I have IOtest.rb with one line:

I0.read('somelocalfile')

But when I load it in irb:

irb(main):001:0> load 'IOtest.rb'
NameError: uninitialized constant Object::I0
from IOtest.rb:1:in `<top (required)>'
from (irb):1:in `load'
from (irb):1

Now, when I call IO.read directly:

irb(main):002:0> IO.read('somelocalfile')

it works! (prints the file contents to the command line)

I tried putting the IOtest.rb file in the Ruby bin folder and running it
from there, but still get the error.
Any ideas as to what I'm doing wrong will be appreciated.
Thanks.

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

--
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Search Discussions

  • Everaldo Gomes at Oct 24, 2011 at 1:49 am
    Hi!

    It seems that you Typed the capital letter I followed by zero:

    I0

    The right is the letter I followed by the letter O

    IO

    Can you see that?

    Best regards,
    Everaldo
    On Sun, Oct 23, 2011 at 11:43 PM, PD Dizon wrote:

    Ruby newbie here. I'm trying out Ruby 1.9.2 on Windows (RubyInstaller)
    and encountered
    some strangeness in using the IO class.

    I have IOtest.rb with one line:

    I0.read('somelocalfile')

    But when I load it in irb:

    irb(main):001:0> load 'IOtest.rb'
    NameError: uninitialized constant Object::I0
    from IOtest.rb:1:in `<top (required)>'
    from (irb):1:in `load'
    from (irb):1

    Now, when I call IO.read directly:

    irb(main):002:0> IO.read('somelocalfile')

    it works! (prints the file contents to the command line)

    I tried putting the IOtest.rb file in the Ruby bin folder and running it
    from there, but still get the error.
    Any ideas as to what I'm doing wrong will be appreciated.
    Thanks.

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

    --
    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 rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to
    rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at
    http://groups.google.com/group/rubyonrails-talk?hl=en.
    --
    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 rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
  • PD Dizon at Oct 24, 2011 at 2:12 am

    Everaldo Gomes wrote in post #1028059:
    Hi!

    It seems that you Typed the capital letter I followed by zero:

    I0

    The right is the letter I followed by the letter O

    IO

    Can you see that?

    Best regards,
    Everaldo
    *smacks my forehead*
    It worked! Thanks dude.
    Note to self: get a decent Ruby editor.

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

    --
    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 rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedOct 24, '11 at 1:43a
activeOct 24, '11 at 2:12a
posts3
users2
websiterubyonrails.org
irc#RubyOnRails

2 users in discussion

PD Dizon: 2 posts Everaldo Gomes: 1 post

People

Translate

site design / logo © 2022 Grokbase