Created
October 20, 2014 10:39
-
-
Save plexus/70b9cd47978f947682e1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Hexp | |
# Transparently use Hexp nodes in templates | |
class Node | |
def to_s | |
to_html.html_safe | |
end | |
end | |
# Honor ActiveSupport::SafeBuffer's "html_safe" flag | |
class Unparser | |
alias orig_escape_text escape_text | |
def escape_text(text) | |
text.html_safe? ? text : orig_escape_text(text) | |
end | |
end | |
end | |
# Opt-in to NilClass#to_hexp | |
require 'hexp/core_ext/nil' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment