Sha256: 8153828484134ab88e7f758740af412f94d9da4378388bd6d0165e9238bd0fa1

Contents?: true

Size: 680 Bytes

Versions: 9

Compression:

Stored size: 680 Bytes

Contents

module Loofah
  module Helpers
    class << self
      #
      #  A replacement for Rails's built-in +strip_tags+ helper.
      #
      #   Loofah::Helpers.strip_tags("<div>Hello <b>there</b></div>") # => "Hello there"
      #
      def strip_tags(string_or_io)
        Loofah.fragment(string_or_io).text
      end

      #
      #  A replacement for Rails's built-in +sanitize+ helper.
      #
      #   Loofah::Helpers.sanitize("<script src=http://ha.ckers.org/xss.js></script>") # => "&lt;script src=\"http://ha.ckers.org/xss.js\"&gt;&lt;/script&gt;"
      #
      def sanitize(string_or_io)
        Loofah.scrub_fragment(string_or_io, :strip).to_s
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
loofah-0.4.6 lib/loofah/helpers.rb
loofah-0.4.5 lib/loofah/helpers.rb
loofah-0.4.4 lib/loofah/helpers.rb
loofah-0.4.3 lib/loofah/helpers.rb
loofah-0.4.2 lib/loofah/helpers.rb
loofah-0.4.1 lib/loofah/helpers.rb
loofah-0.4.0 lib/loofah/helpers.rb
loofah-0.3.1 lib/loofah/helpers.rb
loofah-0.3.0 lib/loofah/helpers.rb