Daniel Sche wrote:
> Hello
> 
> irb(main):177:0* y=0
> => 0
> irb(main):178:0> def y; 1; end
> => nil
> irb(main):179:0> y
> => 0
> irb(main):180:0> y()
> => 1
> irb(main):181:0> y.class
> => Fixnum
> irb(main):182:0>
> 
> how to get the class of the function y?
> or object_id for example?
>

You have defined a method #y in the "top-level object", which irb calls
"main". It's not an object itself.

irb(main):001:0> self
=> main
irb(main):002:0> self.methods.grep /y/
=> ["type", "display"]
irb(main):003:0> def y; 1; end
=> nil
irb(main):004:0> self.methods.grep /y/
=> ["type", "display", "y"]