Term rewriting for Ruby programs