Mega Code Archive

 
Categories / Ruby / Reflection
 

Convert all system command to all class method

class CommandWrapper   def method_missing(method, *args)     system(method.to_s, *args)   end end cw = CommandWrapper.new cw.date                   # Sat Apr 28 22:50:11 CDT 2001 cw.du '-s', '/tmp'        # 166749  /tmp