Class: XmlUtils::Comment

Inherits:
ChildNode show all
Defined in:
lib/xmlutils/node.rb

Instance Attribute Summary collapse

Attributes inherited from Node

#parent

Instance Method Summary collapse

Methods inherited from ChildNode

#write

Methods inherited from Node

#deep_clone, #document, #each, #next_sibling, #previous_sibling, #remove, #root, #to_s

Constructor Details

#initialize(string, parent = nil) ⇒ Comment

Returns a new instance of Comment.



204
205
206
207
208
# File 'lib/xmlutils/node.rb', line 204

def initialize(string, parent = nil)
  super()
  @parent = parent
  @string = string.to_s
end

Instance Attribute Details

#stringObject

Returns the value of attribute string.



202
203
204
# File 'lib/xmlutils/node.rb', line 202

def string
  @string
end

Instance Method Details

#cloneObject



214
215
216
# File 'lib/xmlutils/node.rb', line 214

def clone
  Comment.new(@string)
end

#node_typeObject



210
211
212
# File 'lib/xmlutils/node.rb', line 210

def node_type
  :comment
end

#write_content(output, indent = 0) ⇒ Object



218
219
220
# File 'lib/xmlutils/node.rb', line 218

def write_content(output, indent = 0)
  output << "<!--#{@string}-->"
end