Module: Hache

Defined in:
lib/hache.rb

Constant Summary collapse

HTML_ESCAPE =
{
  "&" => "&",
  ">" => ">",
  "<" => "&lt;",
  '"' => "&quot;",
  "'" => "&#x27;",
  "/" => "&#x2F;"
}
UNSAFE =
/[&"'><\/]/

Class Method Summary collapse

Class Method Details

.h(s) ⇒ Object



13
14
15
# File 'lib/hache.rb', line 13

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