'require' is not loading files

I am new to ruby and have been teaching it to myself for the past so I
am still very new to Ruby. I have been trying to load external
source-code files into my program but for some reason every time I try
use require to load a file it does not work and I get this message

LoadError: cannot load such file -- b
        from
/usr/local/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in
`require'
        from
/usr/local/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in
`require'
        from (irb):3
        from /usr/local/bin/irb:12:in `<main>'
irb(main):004:0> require

For example I create a file named a.rb and then in another program I try
to load it with require 'a' but I always get this message. When I use
load 'a.rb' it loads the file with no problem but I can not figure out
why require '' will not load the files into the program. Like I said I
am very new to Ruby so any help is appreciated.

···

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

Sorry for the delay!

Quoting Elliot M. (lists@ruby-forum.com):

I am new to ruby and have been teaching it to myself for the past so I
am still very new to Ruby. I have been trying to load external
source-code files into my program but for some reason every time I try
use require to load a file it does not work and I get this message

LoadError: cannot load such file -- b

Recent Ruby does not include the current directory when looking for
scripts to load. Either use

require './b'

or, maybe more expressive, use

require_relative 'b'

You can also opt to include '.' in the RUBYLIB global variable.

Carlo

···

Subject: 'require' is not loading files
  Date: lun 03 giu 13 01:25:10 +0900

--
  * Se la Strada e la sua Virtu' non fossero state messe da parte,
* K * Carlo E. Prelz - fluido@fluido.as che bisogno ci sarebbe
  * di parlare tanto di amore e di rettitudine? (Chuang-Tzu)

require './b'

or

require_relative 'b'

···

2013/6/3 Elliot M. <lists@ruby-forum.com>

I am new to ruby and have been teaching it to myself for the past so I
am still very new to Ruby. I have been trying to load external
source-code files into my program but for some reason every time I try
use require to load a file it does not work and I get this message

LoadError: cannot load such file -- b
        from
/usr/local/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in
`require'
        from
/usr/local/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in
`require'
        from (irb):3
        from /usr/local/bin/irb:12:in `<main>'
irb(main):004:0> require

For example I create a file named a.rb and then in another program I try
to load it with require 'a' but I always get this message. When I use
load 'a.rb' it loads the file with no problem but I can not figure out
why require '' will not load the files into the program. Like I said I
am very new to Ruby so any help is appreciated.

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

Thank you for the help. require './a' works just like it should.

···

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

Note that require_relative will not work with irb.

···

Am 03.06.2013 07:32, schrieb Carlo E. Prelz:

require './b'

or, maybe more expressive, use

require_relative 'b'

--
<https://github.com/stomar/&gt;