Hi,

I'd like to propose a new addition to the enum module.

detect works great but doesn't supply the index of the match. It would
be nice to have a method detect_index that returned the index rather
than the object.

Use example:

irb(main):001:0> foo =`uptime`.strip.split(' ')
=> ["14:36:06", "up", "157", "days,", "16:59,", "35", "users,", "load",
"average:", "0.54,", "0.31,", "0.27"]
irb(main):002:0> bar=nil
=> nil
irb(main):003:0> foo.each_with_index {|o,i| if o=="users,"; bar=i;
break; end;}
=> nil
irb(main):004:0> foo[2..bar-2]
=> ["157", "days,", "16:59,"]

Lines 2 to 4 would be expressed in a much more concise manner, i.e.

irb(main):001:0> foo =`uptime`.strip.split(' ')
=> ["14:36:06", "up", "157", "days,", "16:59,", "35", "users,", "load",
"average:", "0.54,", "0.31,", "0.27"]
irb(main):002:0> foo[2..foo.detect_index {|o| o=="users,"}-2]
=> ["157", "days,", "16:59,"]

Thoughts?

Jon T