Sha256: e72cc1843a88d6c4debe22239ddaa92415a6026bbd8bd2f7feddf386ae33d03f

Contents?: true

Size: 612 Bytes

Versions: 2

Compression:

Stored size: 612 Bytes

Contents

module Loofah
  module HTML # :nodoc:
    #
    #  Subclass of Nokogiri::HTML::Document.
    #
    #  See Loofah::ScrubBehavior and Loofah::DocumentDecorator for additional methods.
    #
    class Document < Nokogiri::HTML::Document
      include Loofah::ScrubBehavior::Node
      include Loofah::DocumentDecorator

      #
      #  Returns a plain-text version of the markup contained by the document,
      #  with HTML entities encoded.
      #
      def text
        encode_special_chars xpath("/html/body").inner_text
      end
      alias :inner_text :text
      alias :to_str     :text
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
loofah-0.4.6 lib/loofah/html/document.rb
loofah-0.4.5 lib/loofah/html/document.rb