Class: RGitHook::Helpers

Inherits:
Object
  • Object
show all
Defined in:
lib/rgithook/githook.rb

Constant Summary collapse

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

Class Method Summary collapse

Class Method Details

.html_escape(text) ⇒ Object

Returns a copy of text with ampersands, angle brackets and quotes escaped into HTML entities.



127
128
129
# File 'lib/rgithook/githook.rb', line 127

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