It's better to use `class_eval` here IMHO.
Also the body can be shortened, so the results will become:

``` ruby
%w[proxy params form json body follow].each do |method_name|
  class_eval <<-RUBY, __FILE__, __LINE__
    def with_#{method_name}(value)
      dup { |opts| opts.#{method_name} = value }
    end
  RUBY
end
```