= sub_diff

Allows you to apply regular expression replacements to strings while presenting the result in a "diff" like format

== Installation

  gem install sub_diff


== Usage

<tt>String#gsub_diff</tt> or <tt>String#sub_diff</tt> accept the same arguments as the standard <tt>gsub</tt> and <tt>sub</tt> methods, however the returned object is enumerable and allows you to iterate thru each replacement

  replacement = 'this is a test'.gsub_diff(/(\S*is)/, 'x(\1)')
  
  puts replacement
  # => x(this) x(is) a test
  
  replacement.each { |diff| puts [diff.changed?, diff.value_was.inspect, diff.value.inspect].join(' - ') }
  # => true - "this" - "x(this)"
  # => false - " " - " "
  # => true - "is" - "x(is)"
  # => false - " a test" - " a test"


== Patches and pull requests

* Fork the project.
* Make your feature addition or bug fix.
* Add tests for it. This is important so I don't break it in a future version unintentionally.
* Commit, do not mess with Rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
* Send me a pull request. Bonus points for topic branches.