1.class vs method1.class

so 1.class will give Fixnum…

but when i define a method

def foo
puts “ha”
end

how can i invoke

foo.class

as it is taking what foo returns… as then invoke class on that.

On Sep 19, 2007, at 8:19 AM, SpringFlowers AutumnMoon wrote:

foo.class

def foo; end
=> nil

method(:foo).class
=> Method

Hope that helps.

James Edward G. II

SpringFlowers AutumnMoon wrote:

foo.class

as it is taking what foo returns… as then invoke class on that.

becouse foo returns what puts returns and it’s nil, and nil have
NilClass

you have to understand that in ruby EVERYTHING returns value (even if
it’s nil) and everything is object (even nil)