Where's Enumerable?

Discussion in 'Ruby' started by Just Another Victim of the Ambient Morality, Aug 14, 2006.

  1. 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...
    Just Another Victim of the Ambient Morality, Aug 14, 2006
    #1
    1. Advertising

  2. Just Another Victim of the Ambient Morality

    Hal Fulton Guest

    Just Another Victim of the Ambient Morality wrote:
    > 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...


    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
    Hal Fulton, Aug 14, 2006
    #2
    1. Advertising

  3. On 8/13/06, Just Another Victim of the Ambient Morality
    <> 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/
    Rick DeNatale, Aug 14, 2006
    #3
  4. "Hal Fulton" <> wrote in message
    news:...
    > Just Another Victim of the Ambient Morality wrote:
    >>
    >> 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


    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 == 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...
    Just Another Victim of the Ambient Morality, Aug 14, 2006
    #4
  5. On Aug 13, 2006, at 10:15 PM, Just Another Victim of the Ambient
    Morality wrote:

    >
    > "Hal Fulton" <> wrote in message
    > news:...
    >> Just Another Victim of the Ambient Morality wrote:
    >>>
    >>> 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

    >
    > 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 == 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?


    Yes.

    p Array.ancestors

    > Thank you for the clarification! I always like to understand
    > what's
    > going on...
    >
    >
    >
    >
    Logan Capaldo, Aug 14, 2006
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jason Creighton

    Why isn't Enumerable in StringIO?

    Jason Creighton, Jul 25, 2003, in forum: Ruby
    Replies:
    1
    Views:
    100
  2. Pierre-Charles David

    Support for arbitrary iterators in Enumerable?

    Pierre-Charles David, Oct 2, 2003, in forum: Ruby
    Replies:
    2
    Views:
    128
  3. Nathaniel Talbott

    Enumerable#inject is surprising me...

    Nathaniel Talbott, Oct 7, 2003, in forum: Ruby
    Replies:
    0
    Views:
    87
    Nathaniel Talbott
    Oct 7, 2003
  4. Harry Ohlsen

    An addition to Array (or Enumerable)?

    Harry Ohlsen, Dec 28, 2003, in forum: Ruby
    Replies:
    11
    Views:
    176
    Dave Thomas
    Dec 29, 2003
  5. Daniel Sheppard
    Replies:
    0
    Views:
    104
    Daniel Sheppard
    Sep 16, 2005
Loading...

Share This Page