Sha256: 0e834ef73caa1b4d8c10d9560d5fc24e6657306855e6fc34715aa1ef83134b7a

Contents?: true

Size: 1.58 KB

Versions: 1

Compression:

Stored size: 1.58 KB

Contents

module Loofah
  class << self
    def strip_tags(string_or_io) # :nodoc:
      warn_once "WARNING: Loofah.strip_tags is deprecated and will be removed in Loofah 0.3.0. Please switch to Loofah.scrub_document(string_or_io, :prune)"
      Loofah.scrub_document(string_or_io, :prune).text
    end
    
    def whitewash(string_or_io) # :nodoc:
      warn_once "WARNING: Loofah.whitewash is deprecated and will be removed in Loofah 0.3.0. Please switch to Loofah.scrub_fragment(string_or_io, :whitewash)"
      Loofah.scrub_fragment(string_or_io, :whitewash).to_s
    end

    def whitewash_document(string_or_io) # :nodoc:
      warn_once "WARNING: Loofah.whitewash_document is deprecated and will be removed in Loofah 0.3.0. Please switch to Loofah.scrub_document(string_or_io, :whitewash)"
      Loofah.scrub_document(string_or_io, :whitewash).to_s
    end

    def sanitize(string_or_io) # :nodoc:
      warn_once "WARNING: Loofah.sanitize is deprecated and will be removed in Loofah 0.3.0. Please switch to Loofah.scrub_fragment(string_or_io, :escape)"
      Loofah.scrub_fragment(string_or_io, :escape).to_xml
    end
    
    def sanitize_document(string_or_io) # :nodoc:
      warn_once "WARNING: Loofah.sanitize_document is deprecated and will be removed in Loofah 0.3.0. Please switch to Loofah.scrub_document(string_or_io, :escape)"
      Loofah.scrub_document(string_or_io, :escape).to_xml
    end

    private

    def warn_once(message) # :nodoc:
      @aooga ||= {}
      unless @aooga.key?(message)
        warn message unless @aooga[message]
        @aooga[message] = true
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
loofah-0.2.2 lib/loofah/deprecated.rb