I am creating a new module:
module M
def self.g
end
end
I would like to list all the (class-) methods defined in M
. Of course, M.public_methods
also listed the methods from Object
, so I tried:
M.public_methods(false)
but when I try this in irb, it still lists a number of additional methods:
M.public_methods(false)
# => [:g, :freeze, :===, :==, :<=>, :<, :<=, :>, :>=, :to_s, :inspect, :included_modules, β¦]
I can get the result I want to use
M.public_methods(false) - Object.public_methods
what surprises me. Should the parameter false
already get rid of all the methods Object
?
source
share