From: Eric Christopherson Date: 2013-04-18T13:37:12+09:00 Subject: Re: Running file from command line issue --089e01536604d9a8f804da9b27b1 Content-Type: text/plain; charset=UTF-8 On Wed, Apr 17, 2013 at 8:46 PM, Gouverneur Cadwalader wrote: > Hello. This is my first post and I'm new to coding and ruby. I'm > trying to learn the basics right now from Lynda.com. I'm trying to run > the above file "methods.rb" from the command line. In the command prompt > I navigate to the correct folder, switch to irb, and then I use > >require"methods.rb". > > In the lynda tutorial video, this returns >true. It works. > > When I do it, I get > > LoadError: cannot load such file -- methods.rb > from > C:/Ruby200/lob/ruby/2.0/rubygems/core_ext/kernel_require.rb:45:in > 'require' > from > C:/Ruby200/lob/ruby/2.0/rubygems/core_ext/kernel_require.rb:45:in > 'require' > from (irb):2 > from C:/Ruby200/bin/irb:12:in '
' > > This tutorial I'm watching is about four years old, so he's using an > older version of ruby. I know this is probably the simplest thing, but > as a newbie I have zero decoding skill. Any help would be appreciated. > I think that's it. Ruby from 1.9.2 on does not allow you to `require` files in the current working directory, unless you add that directory to $LOAD_PATH; earlier versions automatically put it there for you. The easiest way around that is to use `require_relative`. I don't know what the Lynda tutorial does with code that you've required, but if you just want to run a Ruby file from Windows's cmd, you can just run `ruby methods.rb`. That's a little more direct, but it puts you back in cmd when it finishes. > > Lastly, if you know of a better way to start learning ruby than the > lynda tutorail series, I'm very open to input of any kind. > > Thanks in advance, > -S. > --089e01536604d9a8f804da9b27b1 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
On Wed, Apr 17, 2013 at 8:46 PM, Gouverneur Cadwalader <lists@ruby-forum.com> wrote:
=
Hello. This is my first post and I'm new= to coding and ruby. I'm
trying to learn the basics right now from Lynda.com. I'm trying to run<= br> the above file "methods.rb" from the command line. In the command= prompt
I navigate to the correct folder, switch to irb, and then I use
>require"methods.rb".

In the lynda tutorial video, this returns >true. It works.

When I do it, I get

LoadError: cannot load such file -- methods.rb
=C2=A0 =C2=A0from
C:/Ruby200/lob/ruby/2.0/rubygems/core_ext/kernel_require.rb:45:in
'require'
=C2=A0 =C2=A0from
C:/Ruby200/lob/ruby/2.0/rubygems/core_ext/kernel_require.rb:45:in
'require'
=C2=A0 =C2=A0from (irb):2
=C2=A0 =C2=A0from C:/Ruby200/bin/irb:12:in '<main>'

This tutorial I'm watching is about four years old, so he's using a= n
older version of ruby. I know this is probably the simplest thing, but
as a newbie I have zero decoding skill. Any help would be appreciated.
<= /blockquote>

I think that's it. Ruby from 1.9.= 2 on does not allow you to `require` files in the current working directory= , unless you add that directory to $LOAD_PATH; earlier versions automatical= ly put it there for you. The easiest way around that is to use `require_rel= ative`.

I don't know what the Lynda tutorial do= es with code that you've required, but if you just want to run a Ruby f= ile from Windows's cmd, you can just run `ruby methods.rb`. That's = a little more direct, but it puts you back in cmd when it finishes.
=C2=A0

Lastly, if you know of a better way to start learning ruby than the
lynda tutorail series, I'm very open to input of any kind.

Thanks in advance,
-S.
--089e01536604d9a8f804da9b27b1--