How will you rename and delete a file in Ruby?
Answer / Nisar Ahmad
To rename a file, you can use the File.rename method: File.rename('old_filename', 'new_filename'). To delete a file, you can use the File.delete method: File.delete('filename')
| Is This Answer Correct ? | 0 Yes | 0 No |
What is the use of interpolation in ruby?
How would you freeze an object in ruby?
Explain Ruby hashes?
Explain me what is the difference between symbol and string?
Please explain each of the following operators and how and when they should be used: ==, ===, eql?, Equal?
Explain the types of variables available in ruby class?
Tell me how you can create a controller for subject?
What's the difference in scope for these two variables: @name and @@name?
Explain Ruby if-else statement?
Tell me what is the role of sub-directory app/controllers and app/helpers?
How is object methods defined in ruby?
How would you implement hash in ruby internally?