1.不用self
class Test
class << self
def a
puts "static method"
end
end
end
2. self的方式
class Test
def self.a
puts "static method"
end
end
调用