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 |
Tell us what is class libraries in ruby?
mention what is the difference between a single quote and double quote?
Explain about Class variable and global variable?
what is a class library in Ruby?
Explain the types of variables available in ruby class?
What are the data types in ruby?
What are the three levels of method access control for classes and what do they signify? What do they imply about the method?
What is sysread method in Ruby?
Difference between render and redirect?
Tell me what is the difference between calling super() and super call?
Can method names be capitalized?
What are ruby variables.