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



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

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