I can't run a program I just created! Are spaces in file names a problem?

Using ruby with windows vista, created a new program and I’m in the
correct directory on the command line but I keep getting a load error.
Even after checking my spelling exactly matches the file name. I put a
space
in the name of the file I created does this cause problems?

more or less. You either need to:

  1. remove the space(s) from the ruby filename.
  2. use quotes around the name like this:
    c:>ruby my filename.rb

I tend to avoid spaces whenever possible but quotes also work.

Wayne B. wrote in post #1128038:

more or less. You either need to:

  1. remove the space(s) from the ruby filename.
  2. use quotes around the name like this:
    c:>ruby my filename.rb

I tend to avoid spaces whenever possible but quotes also work.

I can’t see the quotes, it should be c:>ruby “my filename.rb”
The usual Ruby way is to use underscores in place of spaces, and all
lowercase as well.

FYI, this isn’t just Ruby. The command prompt treats a space as a
delimiter to the next argument unless it’s in quotes.

c:>executable argument1 argument2

Thanks again guys, I had no idea about quotes or underscores, is there
any reason for always using lowercase. Also funny story Joel, I know a
programmer friend of mine who’s name is Joel Parsons. Spooky!

I believe that the reason for a lowercase standard is that Linux tends
to be case-sensitive when dealing with filenames. If it’s all lowercase,
there’s no misunderstanding. If you were to write a program which worked
on Windows’ case-insensitive filesystem then it might fail when migrated
into a Linux environment.

Not directly related, but useful to know: Anything starting with an
uppercase letter in Ruby is a constant.

Another reason (in my mind), is that CamelCaseIsHarderToRead
than_underscored_phrases.

Legend! As always! That text really illustrates it nicely.

On Nov 20, 2013, at 6:26 AM, Joel P. [email protected] wrote:

than_underscored_phrases.


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

also_known_as_snake_case :slight_smile: