Module: ERB::Util

Included in:
ActionView::Base, ActionView::Helpers::FormOptionsHelper, ActionView::Helpers::TagHelper
Defined in:
lib/action_view/template_handlers/erb.rb

Constant Summary collapse

HTML_ESCAPE =
{ '&' => '&amp;', '"' => '&quot;', '>' => '&gt;', '<' => '&lt;' }

Instance Method Summary collapse

Instance Method Details

#html_escape(s) ⇒ Object



7
8
9
# File 'lib/action_view/template_handlers/erb.rb', line 7

def html_escape(s)
  s.to_s.gsub(/[&"><]/) { |special| HTML_ESCAPE[special] }
end