Question

I followed the instructions from the RubyGame wiki. Everything worked up until I tried to run the application:

ruby a_rubygame_app.rb

# => ruby: No such file or directory -- a_rubygame_app.rb (LoadError)

What happened?

Was it helpful?

Solution

a_rubygame_app.rb is not the actual name of any file... In the install docs, they've used a common programmer technique of naming a file with something that should look like it needs to be replaced.

This is often done with things like /path/to/yourfile – which is not a path to any actual file on your computer, but is meant to be replaced with an actual path and filename – or obj.my_method, which is meant to indicate that you call a method you've created by replacing my_method with the actual method name.

According to the rubygame README,

We also recommend that you take a peek at the demo applications in
the 'samples' directory, especially image_viewer.rb,
demo_rubygame.rb, and chimp.rb.

Try to find your way into the samples directory, and then try running ruby image_viewer.rb, ruby demo_rubygame.rb or ruby chimp.rb.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top