Class: Noodlecr

Inherits:
Noodle::Node show all
Defined in:
lib/noodlecr.rb

Overview

Noodlecr inherit to Noodle::Node you need to read Noodle::Node for understand how we work !

Instance Attribute Summary

Attributes inherited from Noodle::Node

#childs, #content, #name, #parent

Instance Method Summary collapse

Methods inherited from Noodle::Node

#addChild, #attr, #deleteAttr, #listAttr, #newChild, #next, #previous, #setParent

Constructor Details

#initializeNoodlecr

Returns a new instance of Noodlecr.



5
6
7
8
# File 'lib/noodlecr.rb', line 5

def initialize
  super "superfather"
  @big_father = nil
end

Instance Method Details

#to_xml(encoding = false) ⇒ Object

we override to_xml because Noodlecr is special node without name, Noodlecr is a big father ! Becarefull : we return a string value !! Need to rename this method to_s ?



12
13
14
15
16
17
18
# File 'lib/noodlecr.rb', line 12

def to_xml(encoding = false)
  data = "<?xml version=\"1.0\"#{" encoding=\"utf-8\"" if encoding}?>" # useless encoding ? i don't know said me
  @childs.each do |child|
    data += child.to_xml
  end
  return data
end