haml/haml — pull request #629 by lsylvester (2013-02-13 11:44:58+00:00)
Title: Combine two gsub calls into one with a regex

String#gsub! is just as fast with a regex as it is with a string - so we can combine the two gsubs! into one with a regex.

```ruby
Benchmark.bm do |x|
x.report{ 10000.times{ Haml::Compiler.build_attributes(true, '"', true, true, "type" => "text", "value" => "Foo\"B'ar")}}
x.report{ 10000.times{ Haml::Compiler.build_attributes(true, '"', true, true, "type" => "text", "value" => "FooBar")}}
end
```
```
Before:
user system total real
1.520000 0.010000 1.530000 ( 1.535725)
1.200000 0.010000 1.210000 ( 1.199978)

After:
user system total real
0.790000 0.000000 0.790000 ( 0.787912)
0.500000 0.010000 0.510000 ( 0.498231)