[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

irb parser error?

jzakiya

1/25/2006 6:56:00 PM

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?

3 Answers

jzakiya

1/25/2006 6:59:00 PM

0

Typo correction:
irb(main):001:0> require "~/'Ruby Stuff'/fibtimes.rb"

Mike Fletcher

1/25/2006 7:07:00 PM

0

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"





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


jzakiya

1/26/2006 5:14:00 AM

0

Perfecto!! That solved it.

Thanks.