Module: RomanticText::Utils

Defined in:
lib/romantic_text/utils.rb

Class Method Summary collapse

Class Method Details

.escape(text) ⇒ Object



12
13
14
# File 'lib/romantic_text/utils.rb', line 12

def escape(text)
  html_safe?(text) ? text.to_s : CGI.escapeHTML(text.to_s)
end

.html_safe?(text) ⇒ Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/romantic_text/utils.rb', line 8

def html_safe?(text)
  text.respond_to?(:html_safe?) ? text.html_safe? : false
end