Irb parser error?

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?

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

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”

Perfecto!! That solved it.

Thanks.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs