Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


Tell me how would you freeze an object in ruby? Can you provide a simple example?



Tell me how would you freeze an object in ruby? Can you provide a simple example?..

Answer / Swamjeet Singh

In Ruby, you can freeze an object to prevent it from being modified by using the `freeze` method. Once frozen, the object cannot be altered and will raise a RuntimeError if any attempt is made to modify it.n- For example: `obj = {}.freeze; obj[:key] = 'value' # raises RuntimeError`

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Ruby Interview Questions

Tell us what is class libraries in ruby?

1 Answers  


mention what is the difference between a single quote and double quote?

1 Answers  


Explain about Class variable and global variable?

1 Answers  


what is a class library in Ruby?

1 Answers  


Explain the types of variables available in ruby class?

1 Answers  


What are the data types in ruby?

1 Answers  


What are the three levels of method access control for classes and what do they signify? What do they imply about the method?

1 Answers  


What is sysread method in Ruby?

1 Answers  


Difference between render and redirect?

1 Answers  


Tell me what is the difference between calling super() and super call?

1 Answers  


Can method names be capitalized?

1 Answers  


What are ruby variables.

1 Answers  


Categories