Class: XmlUtils::ProcessingInstruction
- Defined in:
- lib/xmlutils/node.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#content ⇒ Object
Returns the value of attribute content.
-
#target ⇒ Object
Returns the value of attribute target.
Attributes inherited from Node
Instance Method Summary collapse
- #clone ⇒ Object
-
#initialize(target, content = nil, parent = nil) ⇒ ProcessingInstruction
constructor
A new instance of ProcessingInstruction.
- #node_type ⇒ Object
- #write_content(output, indent = 0) ⇒ Object
Methods inherited from ChildNode
Methods inherited from Node
#deep_clone, #document, #each, #next_sibling, #previous_sibling, #remove, #root, #to_s
Constructor Details
#initialize(target, content = nil, parent = nil) ⇒ ProcessingInstruction
Returns a new instance of ProcessingInstruction.
226 227 228 229 230 231 |
# File 'lib/xmlutils/node.rb', line 226 def initialize(target, content = nil, parent = nil) super() @parent = parent @target = target @content = content end |
Instance Attribute Details
#content ⇒ Object
Returns the value of attribute content.
224 225 226 |
# File 'lib/xmlutils/node.rb', line 224 def content @content end |
#target ⇒ Object
Returns the value of attribute target.
224 225 226 |
# File 'lib/xmlutils/node.rb', line 224 def target @target end |
Instance Method Details
#clone ⇒ Object
237 238 239 |
# File 'lib/xmlutils/node.rb', line 237 def clone ProcessingInstruction.new(@target, @content) end |
#node_type ⇒ Object
233 234 235 |
# File 'lib/xmlutils/node.rb', line 233 def node_type :processing_instruction end |
#write_content(output, indent = 0) ⇒ Object
241 242 243 244 245 246 247 |
# File 'lib/xmlutils/node.rb', line 241 def write_content(output, indent = 0) if @content && !@content.empty? output << "<?#{@target} #{@content}?>" else output << "<?#{@target}?>" end end |