Objects

 
   

Ruby Way
By Hal Fulton
Slots : 1.0
Table of Contents
 


In Python, everything is an object, but not necessarily an instance of a class. In Ruby, objects are always instances by default, and there is essentially no difference between an object's type and its class.

Each object has a unique ID. There is no is keyword in Ruby. You can use Object#equal? to compare object identities. See also Object#id. (Note: The hash symbol used like this in documentation is simply notation denoting an arbitrary instance of the named class as the receiver. In real code, you would use the variable for the actual object, followed by a dot and then the method. Using a dot in place of the hash with the named class would indicate a class method instead.)


   

 

 



The Ruby Way
The Ruby Way, Second Edition: Solutions and Techniques in Ruby Programming (2nd Edition)
ISBN: 0672328844
EAN: 2147483647
Year: 2000
Pages: 119
Authors: Hal Fulton

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net