Szymon Drejewicz wrote:
> 
> class MyObject
>   def class
>   end
>   def type
>   end
>   def hello
>    puts "HELLO!"
>   end
> end
> 
> a = MyObject.new
> 
> Question: How to determine type of 'a' object?

Quick hack:

def find_class_of( obj )
  potentials = []
  ObjectSpace.each_object(Class){|c| 
    potentials << c if obj.kind_of? c 
  }
  potentials.sort!.first
end

It will probably break for some wierd, contrived classhierarchy, but I
can't think of one right now...

-- 
(\[ Kent Dahl ]/)_    _~_    __[ http://www.stud.ntnu.no/~kentda/ ]___/~
 ))\_student_/((  \__d L b__/  NTNU - graduate engineering - 5. year  )
( \__\_?|?_/__/ ) _)Industrial economics and technological management(
 \____/_?_\____/ (____engineering.discipline_=_Computer::Technology___)