# Where's Enumerable?

**URL:** <https://www.ruby-forum.com/t/wheres-enumerable/64813>\
**Category:** Ruby\
**Created:** [August 15, 2006, 2:19pm UTC](https://www.ruby-forum.com/t/wheres-enumerable/64813 "2006-08-15T14:19:25Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![maz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e9c0ed/32.png) [@maz](https://www.ruby-forum.com/u/maz)\
**Post date:** [August 15, 2006, 2:19pm UTC](https://www.ruby-forum.com/t/wheres-enumerable/64813/1 "2006-08-15T14:19:25Z")

</div>

This fails with the follow error message:

require ‘Enumerable’

c:/Program  
Files/Ruby/lib/ruby/site\_ruby/1.8/rubygems.custom\_require.rb:18:in  
‘require\_\_’: No such file to load – Enumberable (LoadError)  
from c:/Program  
Files/Ruby/lib/ruby/site\_ruby/1.8/rubygems/custom\_require.rb:18:in  
‘require’  
from D:/temp/rubyfile.rb

```
So, what's up with that? I though Ruby came with Enumerable? What 

```

am I  
doing wrong?  
Thanks…

---

<div class="post-metadata">

**Author:** ![maz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e9c0ed/32.png) [@maz](https://www.ruby-forum.com/u/maz)\
**Post date:** [August 15, 2006, 2:19pm UTC](https://www.ruby-forum.com/t/wheres-enumerable/64813/2 "2006-08-15T14:19:25Z")

</div>

Just Another Victim of the Ambient M. wrote:

> Files/Ruby/lib/ruby/site\_ruby/1.8/rubygems/custom\_require.rb:18:in ‘require’  
> from D:/temp/rubyfile.rb
> 
> ```
> So, what's up with that? I though Ruby came with Enumerable? What am I 
> 
> ```
> 
> doing wrong?  
> Thanks…

You’re looking too hard. 🙂 It’s not in a file, it’s  
a module that’s part of the core.

class MyClass  
include Enumerable  
# …  
end

Cheers,  
Hal

---

<div class="post-metadata">

**Author:** ![maz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e9c0ed/32.png) [@maz](https://www.ruby-forum.com/u/maz)\
**Post date:** [August 15, 2006, 2:19pm UTC](https://www.ruby-forum.com/t/wheres-enumerable/64813/3 "2006-08-15T14:19:25Z")

</div>

On 8/13/06, Just Another Victim of the Ambient M.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> require ‘Enumerable’  
> …  
> ‘require\_\_’: No such file to load – Enumberable (LoadError)

Did you really say

require “Enumerable”

or

require “Enumberable”?

–  
Rick DeNatale

[http://talklikeaduck.denhaven2.com/](http://talklikeaduck.denhaven2.com/)

---

<div class="post-metadata">

**Author:** ![maz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e9c0ed/32.png) [@maz](https://www.ruby-forum.com/u/maz)\
**Post date:** [August 15, 2006, 2:19pm UTC](https://www.ruby-forum.com/t/wheres-enumerable/64813/4 "2006-08-15T14:19:26Z")

</div>

“Hal F.” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote in message  
news:removed\_email\_address@domain.invalid…

> ```
> include Enumerable
> # ...
> 
> ```
> 
> end

```
Ah, thank you. I would never have guessed that I _was_ looking too

```

hard…  
…but now I have another question! I wanted to include Enumerable  
so I  
could do something like this:

%w(a b c d).each\_with\_index do |obj, i|  
if some\_other\_array[i] == obj  
# do something  
end  
end

```
So, just to make sure I understood what I was doing, I removed the

```

“include Enumerable” line of my code and… it all still worked. Now,  
what’s up with that? Array has an “each\_with\_index” already? Does it  
already include Enumerable?  
Thank you for the clarification! I always like to understand what’s  
going on…

---

<div class="post-metadata">

**Author:** ![maz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e9c0ed/32.png) [@maz](https://www.ruby-forum.com/u/maz)\
**Post date:** [August 15, 2006, 2:19pm UTC](https://www.ruby-forum.com/t/wheres-enumerable/64813/5 "2006-08-15T14:19:26Z")

</div>

On Aug 13, 2006, at 10:15 PM, Just Another Victim of the Ambient  
Morality wrote:

> > You’re looking too hard. 🙂 It’s not in a file, it’s  
> > …but now I have another question! I wanted to include
> 
> ```
> So, just to make sure I understood what I was doing, I removed the
> 
> ```
> 
> “include Enumerable” line of my code and… it all still worked. Now,  
> what’s up with that? Array has an “each\_with\_index” already? Does it  
> already include Enumerable?

Yes.

p Array.ancestors
