Module: Hache

Defined in:
lib/hache.rb

Constant Summary collapse

HTML_ESCAPE =
{
  "&" => "&",
  ">" => ">",
  "<" => "&lt;",
  "'" => "&#39;",
  '"' => "&#34;"
}.freeze
UNSAFE =
/[&"'><]/

Class Method Summary collapse

Class Method Details

.h(s) ⇒ Object



16
17
18
# File 'lib/hache.rb', line 16

def h(s)
  s.to_str.gsub(UNSAFE, HTML_ESCAPE)
end