Sha256: 9f18acc0eda8487f620e3ffd178ea34d9c36259ede246331bbe8c961cc4617fd

Contents?: true

Size: 1.36 KB

Versions: 13

Compression:

Stored size: 1.36 KB

Contents

module Nokogiri
  module XML
    class Node
      ###
      # Save options for serializing nodes
      class SaveOptions
        # Format serialized xml
        FORMAT          = 1
        # Do not include delcarations
        NO_DECLARATION  = 2
        # Do not include empty tags
        NO_EMPTY_TAGS   = 4
        # Do not save XHTML
        NO_XHTML        = 8
        # Save as XHTML
        AS_XHTML        = 16
        # Save as XML
        AS_XML          = 32
        # Save as HTML
        AS_HTML         = 64

        # the default for XML documents
        DEFAULT_XML  = FORMAT | AS_XML
        # the default for HTML document
        DEFAULT_HTML = FORMAT | NO_DECLARATION | NO_EMPTY_TAGS | AS_HTML
        # the default for XHTML document
        DEFAULT_XHTML = FORMAT | NO_DECLARATION | NO_EMPTY_TAGS | AS_XHTML

        # Integer representation of the SaveOptions
        attr_reader :options

        # Create a new SaveOptions object with +options+
        def initialize options = 0; @options = options; end

        constants.each do |constant|
          class_eval %{
            def #{constant.downcase}
              @options |= #{constant}
              self
            end

            def #{constant.downcase}?
              #{constant} & @options == #{constant}
            end
          }
        end

        alias :to_i :options
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 2 rubygems

Version Path
nokogiri-1.4.7-java lib/nokogiri/xml/node/save_options.rb
nokogiri-1.4.7-x86-mingw32 lib/nokogiri/xml/node/save_options.rb
nokogiri-1.4.7-x86-mswin32-60 lib/nokogiri/xml/node/save_options.rb
nokogiri-1.4.7 lib/nokogiri/xml/node/save_options.rb
search_biomodel-1.0.0 search_biomodel/ruby/1.8/gems/nokogiri-1.4.6/lib/nokogiri/xml/node/save_options.rb
nokogiri-1.4.6 lib/nokogiri/xml/node/save_options.rb
nokogiri-1.4.6-java lib/nokogiri/xml/node/save_options.rb
nokogiri-1.4.6-x86-mingw32 lib/nokogiri/xml/node/save_options.rb
nokogiri-1.4.6-x86-mswin32-60 lib/nokogiri/xml/node/save_options.rb
nokogiri-1.4.5-java lib/nokogiri/xml/node/save_options.rb
nokogiri-1.4.5 lib/nokogiri/xml/node/save_options.rb
nokogiri-1.4.5-x86-mswin32-60 lib/nokogiri/xml/node/save_options.rb
nokogiri-1.4.5-x86-mingw32 lib/nokogiri/xml/node/save_options.rb