# How to use it: require

**URL:** <https://www.ruby-forum.com/t/how-to-use-it-require/76927>\
**Category:** Ruby\
**Created:** [March 5, 2006, 4:26pm UTC](https://www.ruby-forum.com/t/how-to-use-it-require/76927 "2006-03-05T16:26:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Servando\_G](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ad7895/32.png) [@Servando\_G](https://www.ruby-forum.com/u/Servando_G)\
**Post date:** [March 5, 2006, 4:26pm UTC](https://www.ruby-forum.com/t/how-to-use-it-require/76927/1 "2006-03-05T16:26:37Z")

</div>

I have a custom file filled with a word list. How do call it in my main  
program.  
I have tried “require wordlist” but ruby can’t find the file  
In C/C++ I would have used Include\<wordlist.h\> or for python I would  
have used “import wordlist” so long as the wordlist was placed in the  
same directory I am good. So how do I do this using ruby

Before I forget I want to thank everyone for their help. I am really  
liking Ruby and I finally understand how to use symbols

Sam Garcia

---

<div class="post-metadata">

**Author:** ![Servando\_G](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ad7895/32.png) [@Servando\_G](https://www.ruby-forum.com/u/Servando_G)\
**Post date:** [March 5, 2006, 4:38pm UTC](https://www.ruby-forum.com/t/how-to-use-it-require/76927/2 "2006-03-05T16:38:46Z")

</div>

> I have a custom file filled with a word list. How do call it in my main  
> program.  
> I have tried “require wordlist” but ruby can’t find the file  
> In C/C++ I would have used Include\<wordlist.h\> or for python I would  
> have used “import wordlist” so long as the wordlist was placed in the  
> same directory I am good. So how do I do this using ruby

Call the file wordlist.rb, then require it like this:

require “wordlist”

elKano

---

<div class="post-metadata">

**Author:** ![Servando\_G](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ad7895/32.png) [@Servando\_G](https://www.ruby-forum.com/u/Servando_G)\
**Post date:** [March 5, 2006, 4:38pm UTC](https://www.ruby-forum.com/t/how-to-use-it-require/76927/3 "2006-03-05T16:38:46Z")

</div>

Servando G. wrote:

> I have a custom file filled with a word list. How do call it in my main  
> program.  
> I have tried “require wordlist” but ruby can’t find the file  
> In C/C++ I would have used Include\<wordlist.h\> or for python I would  
> have used “import wordlist” so long as the wordlist was placed in the  
> same directory I am good. So how do I do this using ruby

require is a method call that takes a string.

require ‘wordlist’

‘wordlist’ needs to be in some directory that is part of the Ruby  
interpreter’s current load path.

[http://www.ruby-doc.org/core/classes/Kernel.html#M001980](http://www.ruby-doc.org/core/classes/Kernel.html#M001980)

> Before I forget I want to thank everyone for their help. I am really  
> liking Ruby and I finally understand how to use symbols

Great! Now learn to abuse them!

–  
James B.

[http://www.ruby-doc.org](http://www.ruby-doc.org) - Ruby Help & Documentation  
[Ruby Code & Style](http://www.artima.com/rubycs/) - The Journal By & For Rubyists  
[http://www.rubystuff.com](http://www.rubystuff.com) - The Ruby Store for Ruby Stuff  
[http://www.30secondrule.com](http://www.30secondrule.com) - Building Better Tools
