Always something new

2008 August 12
tags:
by avdi

After 5-6+ years of working with Ruby, I am still periodically reminded of features I’d forgotten about. Today it was the fact that you can override the backtick operator:

>> def `(cmd)
>>   puts "Do you really want to #{cmd}?"
>>   end
=> nil
>> `rm -rf *`
Do you really want to rm -rf *?
=> nil
Bookmark and Share
Creative Commons License
This work, unless otherwise expressly stated, is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License.
blog comments powered by Disqus