Module: HtmlTerminator

Defined in:
lib/html_terminator.rb,
lib/html_terminator/version.rb

Defined Under Namespace

Modules: ClassMethods, InstanceMethods

Constant Summary collapse

SANITIZE_OPTIONS =
{
  :elements => []
}
VERSION =
'6.1.0'

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



71
72
73
74
# File 'lib/html_terminator.rb', line 71

def self.included(base)
  base.send :extend, ClassMethods
  base.send :include, InstanceMethods
end

.sanitize(val, config = {}) ⇒ Object



10
11
12
13
14
15
16
17
18
# File 'lib/html_terminator.rb', line 10

def self.sanitize(val, config = {})
  if val.is_a?(String)
    # Sanitize produces escaped content.
    # Unescape it to get the raw html
    CGI.unescapeHTML(Sanitize.fragment(val, config).strip)
  else
    val
  end
end