Class REXML::XMLDecl
In:
Parent: Child

NEEDS DOCUMENTATION

Methods

==   clone   default   dowrite   encoding=   inspect   new   node_type   nowrite   write  

Included Modules

Constants

DEFAULT_VERSION = "1.0";
DEFAULT_ENCODING = "UTF-8";
DEFAULT_STANDALONE = "no";
START =
STOP = '\?>';

External Aliases

standalone -> stand_alone?
encoding= -> old_enc=

Attributes

standalone  [RW] 
version  [RW] 
writeencoding  [R] 

Public Class methods

[Source]

83:     def XMLDecl.default
84:       rv = XMLDecl.new( "1.0" )
85:       rv.nowrite
86:       rv
87:     end

[Source]

18:                 def initialize(version=DEFAULT_VERSION, encoding=nil, standalone=nil)
19:       @writethis = true
20:       @writeencoding = !encoding.nil?
21:                         if version.kind_of? XMLDecl
22:                                 super()
23:                                 @version = version.version
24:                                 self.encoding = version.encoding
25:         @writeencoding = version.writeencoding
26:                                 @standalone = version.standalone
27:                         else
28:                                 super()
29:                                 @version = version
30:                                 self.encoding = encoding
31:                                 @standalone = standalone
32:                         end
33:                         @version = DEFAULT_VERSION if @version.nil?
34:                 end

Public Instance methods

[Source]

52:                 def ==( other )
53:                   other.kind_of?(XMLDecl) and
54:                   other.version == @version and
55:                   other.encoding == self.encoding and
56:                   other.standalone == @standalone
57:                 end

[Source]

36:                 def clone
37:                         XMLDecl.new(self)
38:                 end

[Source]

93:     def dowrite
94:       @writethis = true
95:     end

[Source]

72:     def encoding=( enc )
73:       if enc.nil?
74:         self.old_enc = "UTF-8"
75:         @writeencoding = false
76:       else
77:         self.old_enc = enc
78:         @writeencoding = true
79:       end
80:       self.dowrite
81:     end

[Source]

97:     def inspect
98:       START.sub(/\\/u, '') + " ... " + STOP.sub(/\\/u, '')
99:     end

[Source]

65:                 def node_type
67:                 end

[Source]

89:     def nowrite
90:       @writethis = false
91:     end

[Source]

40:                 def write writer, indent=-1, transitive=false, ie_hack=false
41:       return nil unless @writethis or writer.kind_of? Output
42:                         indent( writer, indent )
43:                         writer << START.sub(/\\/u, '')
44:       if writer.kind_of? Output
45:         writer << " #{content writer.encoding}"
46:       else
47:         writer << " #{content encoding}"
48:       end
49:                         writer << STOP.sub(/\\/u, '')
50:                 end

[Source]

60:                         @version = version
61:                         self.encoding = encoding
62:                         @standalone = standalone
63:                 end

Search

Google

Ruby API Docs

Links