title: Implementing dry-run in ruby
body: <p>anybody know how to implement dry-run option in Ruby?</p>
  
  <p>I need something like this, but only for ruby.
  <a href="https://serverfault.com/questions/147628/implementing-dry-run-in-bash-scripts">https://serverfault.com/questions/147628/implementing-dry-run-in-bash-scripts</a></p>
  
  <p>I've tried this, but part after <code>else</code> doesn't work:</p>
  
  <pre><code>DRY_RUN = true
  
  def perform(*args)
    command = args
    if DRY_RUN
      command.each{|x| puts x}
    else
     command.each {|x| x}
    end
  end
  
  perform("puts 'Hello'")
  </code></pre>
  
  <p>Thanks for any idea in advance. </p>
  
  <p>P.S I don't want use something like <code>system("ruby -e \"puts 'Hello'\"")</code></p>