Sign up or Sign in | Share
 
ClearMyBench
Welcome, Guest
Please Login or Register.    Lost Password?
Re:Ruby basics (1 viewing) (1) Guest
Go to bottom Post Reply Favoured: 0
TOPIC: Re:Ruby basics
#4607
ShriNi (User)
Software Techie (PEGA) currently on a Career Break
Platinum Boarder
Posts: 4000
graph
User Offline Click here to see the profile of this user
Gender: Female Location: Secundrabad India Birthdate: 1983-09-29
Re:Ruby basics 3 Years, 10 Months ago Karma: 0  
Inheriting Constants

Constants are inherited and can be overridden, much like instance methods can.

There is, however, a very important difference between the inheritance of methods and the inheritance of constants
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#4608
ShriNi (User)
Software Techie (PEGA) currently on a Career Break
Platinum Boarder
Posts: 4000
graph
User Offline Click here to see the profile of this user
Gender: Female Location: Secundrabad India Birthdate: 1983-09-29
Re:Ruby basics 3 Years, 10 Months ago Karma: 0  
Ruby issues a warning when a constant is redefined.
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#4609
ShriNi (User)
Software Techie (PEGA) currently on a Career Break
Platinum Boarder
Posts: 4000
graph
User Offline Click here to see the profile of this user
Gender: Female Location: Secundrabad India Birthdate: 1983-09-29
Re:Ruby basics 3 Years, 10 Months ago Karma: 0  
The Singleton Pattern

A singleton is a class that has only a single instance.

Singletons can be used to store global program state within an object-oriented framework and can be useful alternatives to class methods and class variables.
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#4610
ShriNi (User)
Software Techie (PEGA) currently on a Career Break
Platinum Boarder
Posts: 4000
graph
User Offline Click here to see the profile of this user
Gender: Female Location: Secundrabad India Birthdate: 1983-09-29
Re:Ruby basics 3 Years, 10 Months ago Karma: 0  
Properly implementing a singleton requires a number of the tricks .

The new methods must be made private and other standard methods like dup and clone must be prevented from making copies..
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#4611
ShriNi (User)
Software Techie (PEGA) currently on a Career Break
Platinum Boarder
Posts: 4000
graph
User Offline Click here to see the profile of this user
Gender: Female Location: Secundrabad India Birthdate: 1983-09-29
Re:Ruby basics 3 Years, 10 Months ago Karma: 0  
The Singleton module in the standard library does this work for us.

We just require singleton and then include Singleton into the main class.
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#4612
ShriNi (User)
Software Techie (PEGA) currently on a Career Break
Platinum Boarder
Posts: 4000
graph
User Offline Click here to see the profile of this user
Gender: Female Location: Secundrabad India Birthdate: 1983-09-29
Re:Ruby basics 3 Years, 10 Months ago Karma: 0  
The Singleton module automatically creates the instance class method for us, and we invoke the regular instance method record on that singleton instance.
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
Go to top Post Reply
get the latest posts directly to your desktop
logo footer   Copyright 2009 - 2013 HotRecruiter.Com - All Rights Reserved