Three method define class methods

The following all define class methods within class Demo.
ruby 代码
 
  1. class Demo  
  2.     def Demo.meth1  
  3.     # ...  
  4.     end  
  5.     def self.meth2  
  6.     # ...  
  7.     end  
  8.     class <<self  
  9.         def meth3  
  10.         # ...  
  11.         end  
  12.     end  
  13. end  

你可能感兴趣的:(Ruby)