Forum: Ruby irb parser error?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
unknown (Guest)
on 2006-01-25 20:58
(Received via mailing list)
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?
unknown (Guest)
on 2006-01-25 21:04
(Received via mailing list)
Typo correction:
irb(main):001:0> require "~/'Ruby Stuff'/fibtimes.rb"
Mike F. (Guest)
on 2006-01-25 21:06
unknown wrote:
> 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"
unknown (Guest)
on 2006-01-26 07:20
(Received via mailing list)
Perfecto!! That solved it.

Thanks.
This topic is locked and can not be replied to.