1.不用self
class Test
class << self
def a
puts "static method"
end
end
end
?
??2. self的方式
?
Ruby代码 ? class Test
def self.a
puts "static method"
end
end
?
调用
?
Ruby代码 ?Test.a?转自:http://www.iteye.com/topic/1116041