>>>>> "M" == Mirian Crzig Lennox <mirian / cosmic.com> writes:

M> myObj = MyClass.new(...)
M> elem = anArray[myObj]

 use #to_int

pigeon% cat b.rb
#!/usr/bin/ruby
class MyClass
   def to_int
      1
   end
end
array = [1, 2]
p array[MyClass.new]
pigeon% 

pigeon% b.rb
2
pigeon% 


Guy Decoux