Irb parser error?


#1

I’m using Ruby 1.8.4.

This is no problem.

$ ruby ~/‘Ruby Stuff’/fibtimes.rb

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?


#2

Typo correction:
irb(main):001:0> require “~/‘Ruby Stuff’/fibtimes.rb”


#3

unknown wrote:

I’m using Ruby 1.8.4.

This is no problem.

$ ruby ~/‘Ruby Stuff’/fibtimes.rb

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”


#4

Perfecto!! That solved it.

Thanks.