Skip to content
This repository
Newer
Older
100644 25 lines (22 sloc) 0.563 kb
433dae25 » yabawock
2010-09-27 Whitespace Cleanup
1 # encoding: utf-8
2
d52d8296 » yabawock
2010-04-15 Mark formtastic outputs as html_safe
3 # Adapted from the rails3 compatibility shim in Haml 2.2
4 module Formtastic
2f81ae44 »
2011-01-18 hid a bunch of internal modules from YARD with @private tags
5 # @private
d52d8296 » yabawock
2010-04-15 Mark formtastic outputs as html_safe
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)
457b0984 » sobrinho
2011-01-19 Refactoring on Formtastic::Util.html_safe
17 if text.respond_to?(:html_safe)
18 text.html_safe
19 else
20 text
21 end
d52d8296 » yabawock
2010-04-15 Mark formtastic outputs as html_safe
22 end
4347a852 » sobrinho
2011-02-25 Strip whitespaces
23
d52d8296 » yabawock
2010-04-15 Mark formtastic outputs as html_safe
24 end
25 end
Something went wrong with that request. Please try again.