irb parser error?

J

jzakiya

I'm using Ruby 1.8.4.

This is no problem.

$ ruby ~/'Ruby Stuff'/fibtimes.rb
<correct output>

When I do this, there is a problem.

irb(main):001:0> require "~/'Ruby Stuff'/fibitmes.rb"
LoadError: no such file to load -- ~/'Ruby Stuff'/fibtimes.rb
from (irb):1:in `require'
from (irb):1

I get this even when I use the expanded home path instead of ~.
I also get this error using 'load' instead of 'require'.

I this a bug in the irb parser?
 
M

Mike Fletcher

unknown said:
I'm using Ruby 1.8.4.

This is no problem.

$ ruby ~/'Ruby Stuff'/fibtimes.rb
<correct output>

When I do this, there is a problem.

irb(main):001:0> require "~/'Ruby Stuff'/fibitmes.rb"
LoadError: no such file to load -- ~/'Ruby Stuff'/fibtimes.rb
from (irb):1:in `require'
from (irb):1

I get this even when I use the expanded home path instead of ~.
I also get this error using 'load' instead of 'require'.

I this a bug in the irb parser?

The single quotes are necessary to prevent the shell from interpreting
the space in your filename as a break between words. Inside irb however
they're seen as literal quote characters (i.e. it's looking for a
directory literally named /home/foo/'Ruby Stuff'/

What you need to give ruby would be:

"/home/foo/Ruby Stuff/fibtimes.rb"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
474,202
Messages
2,571,057
Members
47,661
Latest member
FloridaHan

Latest Threads

Top