Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 26 lines (22 sloc) 0.567 kb
433dae2 @yabawock Whitespace Cleanup
yabawock authored
1 # encoding: utf-8
2
d52d829 @yabawock Mark formtastic outputs as html_safe
yabawock authored
3 # Adapted from the rails3 compatibility shim in Haml 2.2
4 module Formtastic
2f81ae4 @justinfrench hid a bunch of internal modules from YARD with @private tags
authored
5 # @private
d52d829 @yabawock Mark formtastic outputs as html_safe
yabawock authored
6 module Util
7 extend self
8 ## Rails XSS Safety
9
10 # Returns the given text, marked as being HTML-safe.
11 # With older versions of the Rails XSS-safety mechanism,
12 # this destructively modifies the HTML-safety of `text`.
13 #
14 # @param text [String]
15 # @return [String] `text`, marked as HTML-safe
16 def html_safe(text)
457b098 @sobrinho Refactoring on Formtastic::Util.html_safe
sobrinho authored
17 if text.respond_to?(:html_safe)
18 text.html_safe
19 else
20 text
21 end
d52d829 @yabawock Mark formtastic outputs as html_safe
yabawock authored
22 end
61877ce @justinfrench shifted remaining stuff into Formtastic::HtmlAttributes
authored
23
d52d829 @yabawock Mark formtastic outputs as html_safe
yabawock authored
24 end
25 end
Something went wrong with that request. Please try again.