irb
require "tr.rb"
LoadError: no such file to load -- tr.rb
from <internal:lib/rubygems/custom_require>:29:in `require'
from <internal:lib/rubygems/custom_require>"29"in `require'
from (irb):4
from C:/Ruby192/bin/irb:12:in `<main>'
load "tr.rb"
Hello world!
=> true
File.exist? "tr.rb"
=> true
APP_ROOT = File.dirname(__FILE__)
=> "."
require "#{APP_ROOT}/tr.rb
LoadError: no such file to load -- ./practice
from....
(same stuff about ruby gems)
Trying to get started learning ruby. From what little I can tell, I
think Irb is only looking in rubygems instead of its own directory.
How do I fix that? This is my first attempt to learn any sort of
programming. Tyvm in advance for any help.
Thank you very much for the help. Could someone be so kind as to show an
example of what that code should look like? I tried the following
without success, all gave error messages.
with the command prompt in the desktop, so the prompt says "
C:\Users\Charles\Desktop , then started irb, so the prompt says
irb(main):001:0
and so on, approximately 30 other variations, including substituting
backslashes for slashes, although in the past I have found that forward
slashes work in ruby on this computer while backslashes sometimes don't.
I googled "require_relative" and found some examples, it looks like the
first one above should have worked. I also tried restarting the computer
and doing it all over again, then tried it on a laptop with winxp. None
of these worked either. Thanks in advance if someone has a minute to
answer this.
Thanks very much again. I really appreciate the help.
I tried typing the green line, but without the " > " symbol, then tried
it with the " > ". I tried typing the line
$ ls
and got an error message and tried it with a one instead of a letter l,
and tried all the other lines. I tried it on two other computers, in all
cases all I got was error messages. What am I doing wrong? Tyvm in
advance, and apologies for being so obtuse.
Thank you very much for taking time to reply sir. I am watching your
videos right now.
I still do not know what to type so to get the program to require that
file, so that any data or code in it, in the file tr.rb, and be able to
use it in the program.
recapping from above, I have tried typing at the irb prompt:
I cannot thank you enough. Josh Cheek rocks. Thanks also to Steve
Klabnik.
I thought I had tried < require './tr' > last night and it didn't
work. It unquestionably does work this morning.
Scrolling up in the terminal window, which is still running, I see I did
try it last night and got error messages. I cannot explain that, but at
least it works now.
"ls" is the Unix tool to list the contents of a directory. The equivalent on
Windows is "dir"
···
On Sun, Oct 9, 2011 at 9:51 PM, charles a. <charles.agriesti@gmail.com>wrote:
Thanks very much again. I really appreciate the help.
I tried typing the green line, but without the " > " symbol, then tried
it with the " > ". I tried typing the line
$ ls
and got an error message and tried it with a one instead of a letter l,
and tried all the other lines. I tried it on two other computers, in all
cases all I got was error messages. What am I doing wrong? Tyvm in
advance, and apologies for being so obtuse.
On Sun, Oct 9, 2011 at 10:17 PM, charles a. <charles.agriesti@gmail.com>wrote:
Thank you very much for taking time to reply sir. I am watching your
videos right now.
I still do not know what to type so to get the program to require that
file, so that any data or code in it, in the file tr.rb, and be able to
use it in the program.
recapping from above, I have tried typing at the irb prompt:
The point he's making is that there is a file in the current directory named
"tr.rb"
···
On Sun, Oct 9, 2011 at 9:58 PM, Josh Cheek <josh.cheek@gmail.com> wrote:
On Sun, Oct 9, 2011 at 9:51 PM, charles a. <charles.agriesti@gmail.com>wrote:
Thanks very much again. I really appreciate the help.
I tried typing the green line, but without the " > " symbol, then tried
it with the " > ". I tried typing the line
$ ls
and got an error message and tried it with a one instead of a letter l,
and tried all the other lines. I tried it on two other computers, in all
cases all I got was error messages. What am I doing wrong? Tyvm in
advance, and apologies for being so obtuse.
"ls" is the Unix tool to list the contents of a directory. The equivalent
on Windows is "dir"