module Loofah

Strings and IO Objects as Input

::document and ::fragment accept any IO object in addition to accepting a string. That IO object could be a file, or a socket, or a StringIO, or anything that responds to read and close. Which makes it particularly easy to sanitize mass quantities of docs.

Constants

REQUIRED_NOKOGIRI_VERSION

The minimum required version of Nokogiri

VERSION

The version of Loofah you are using

Public Class Methods

document(*args, &block) click to toggle source

Shortcut for Loofah::HTML::Document.parse This method accepts the same parameters as Nokogiri::HTML::Document.parse

# File lib/loofah.rb, line 40
def document(*args, &block)
  Loofah::HTML::Document.parse(*args, &block)
end
fragment(*args, &block) click to toggle source

Shortcut for Loofah::HTML::DocumentFragment.parse This method accepts the same parameters as Nokogiri::HTML::DocumentFragment.parse

# File lib/loofah.rb, line 46
def fragment(*args, &block)
  Loofah::HTML::DocumentFragment.parse(*args, &block)
end
scrub_document(string_or_io, method) click to toggle source

Shortcut for ::document.scrub!(method)

# File lib/loofah.rb, line 56
def scrub_document(string_or_io, method)
  Loofah.document(string_or_io).scrub!(method)
end
scrub_fragment(string_or_io, method) click to toggle source

Shortcut for ::fragment.scrub!(method)

# File lib/loofah.rb, line 51
def scrub_fragment(string_or_io, method)
  Loofah.fragment(string_or_io).scrub!(method)
end
scrub_xml_document(string_or_io, method) click to toggle source

Shortcut for ::xml_document.scrub!(method)

# File lib/loofah.rb, line 78
def scrub_xml_document(string_or_io, method)
  Loofah.xml_document(string_or_io).scrub!(method)
end
scrub_xml_fragment(string_or_io, method) click to toggle source

Shortcut for ::xml_fragment.scrub!(method)

# File lib/loofah.rb, line 73
def scrub_xml_fragment(string_or_io, method)
  Loofah.xml_fragment(string_or_io).scrub!(method)
end
xml_document(*args, &block) click to toggle source

Shortcut for Loofah::XML::Document.parse This method accepts the same parameters as Nokogiri::XML::Document.parse

# File lib/loofah.rb, line 62
def xml_document(*args, &block)
  Loofah::XML::Document.parse(*args, &block)
end
xml_fragment(*args, &block) click to toggle source

Shortcut for Loofah::XML::DocumentFragment.parse This method accepts the same parameters as Nokogiri::XML::DocumentFragment.parse

# File lib/loofah.rb, line 68
def xml_fragment(*args, &block)
  Loofah::XML::DocumentFragment.parse(*args, &block)
end