judofyr/temple — pull request #78 by nashbridges (2014-11-05 15:57:36+00:00)
Title: Make Temple::Utils.escape_html_safe universal

I belive the `use_html_safe` was introduced somewhere in [earlier versions of Slim](https://github.com/slim-template/slim/blob/d739b0005f1942584f3b49e702a5b846b6805ae0/lib/slim/compiler.rb), since then it mutated into a pure constant, which is defined during program startup (see [here](https://github.com/judofyr/temple/blob/master/lib/temple/filters/escapable.rb#L12) and [here](https://github.com/slim-template/slim/blob/master/lib/slim/splat/filter.rb#L7))

My proposal is to remove this option, because

a) no one would want to set `use_html_safe: false` if String respond_to? `html_safe?` (Rails env). This would immediately result in double string escaping and decrease overall performance
b) it is not a responsibility of a filter to check whether a string knows about html safeness or not. This responsibility should be delegated to escaper, i.e. Temple::Utils

`Temple::Utils.escape_html_safe` should be that common method that escapes a string and works correctly both with ActiveSupport and without it.

`"".respond_to?(:html_safe?)` check still happens on program startup, no changes here (i.e. Temple still needs to be loaded *after* ActiveSupport).