Class: REXML::Comment
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
self,
Child
|
|
Instance Chain:
|
|
Inherits: |
REXML::Child
|
Defined in: | lib/rexml/comment.rb |
Overview
Represents an XML comment; that is, text between <!– … –>
Constant Summary
-
START =
# File 'lib/rexml/comment.rb', line 9"<!--"
-
STOP =
# File 'lib/rexml/comment.rb', line 10"-->"
Class Method Summary
Instance Attribute Summary
Child - Inherited
#next_sibling | Alias for Node#next_sibling_node. |
#next_sibling= | Sets the next sibling of this child. |
#parent | The Parent of this object. |
#parent= | Sets the parent of this child to the supplied argument. |
#previous_sibling | Alias for Node#previous_sibling_node. |
#previous_sibling= | Sets the previous sibling of this child. |
Node - Included
Instance Method Summary
-
#<=>(other)
Compares this
Comment
to another; the contents of the comment are used in the comparison. -
#==(other)
Compares this
Comment
to another; the contents of the comment are used in the comparison. - #clone
- #node_type
-
#write(output, indent = -1,, transitive = false, ie_hack = false)
DEPRECATED See Formatters
Child - Inherited
#bytes | This doesn't yet handle encodings. |
#document |
|
#remove | Removes this child from the parent. |
#replace_with | Replaces this object with another object. |
Node - Included
#each_recursive | Visit all subnodes of |
#find_first_recursive | Find (and return) first subnode (recursively) for which the block evaluates to true. |
#indent, | |
#index_in_parent | Returns the position that |
#next_sibling_node, #previous_sibling_node, | |
#to_s |
|
Constructor Details
.new(first, second = nil) ⇒ Comment
# File 'lib/rexml/comment.rb', line 24
def initialize( first, second = nil ) super(second) if first.kind_of? String @string = first elsif first.kind_of? Comment @string = first.string end end
Instance Attribute Details
#string (rw) Also known as: #to_s
The content text
# File 'lib/rexml/comment.rb', line 14
attr_accessor :string
#to_s (readonly)
Alias for #string.
# File 'lib/rexml/comment.rb', line 58
alias :to_s :string
Instance Method Details
#<=>(other)
Compares this Comment
to another; the contents of the comment are used in the comparison.
# File 'lib/rexml/comment.rb', line 63
def <=>(other) other.to_s <=> @string end
#==(other)
Compares this Comment
to another; the contents of the comment are used in the comparison.
# File 'lib/rexml/comment.rb', line 70
def ==( other ) other.kind_of? Comment and (other <=> self) == 0 end
#clone
[ GitHub ]# File 'lib/rexml/comment.rb', line 33
def clone Comment.new self end
#node_type
[ GitHub ]# File 'lib/rexml/comment.rb', line 75
def node_type :comment end
#write(output, indent = -1,, transitive = false, ie_hack = false)
DEPRECATED
See Formatters
- output
-
Where to write the string
- indent
-
An integer. If -1, no indenting will be used; otherwise, the indentation will be this number of spaces, and children will be indented an additional amount.
- transitive
-
Ignored by this class. The contents of comments are never modified.
- ie_hack
-
Needed for conformity to the child API, but not used by this class.