Class: Kwaff::Node

Inherits:
Object
  • Object
show all
Defined in:
lib/kwaff/node.rb,
lib/kwaff/rexml.rb

Overview

abstract class

Direct Known Subclasses

Comment, Document, Element, Text

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeNode

Returns a new instance of Node.



26
27
28
# File 'lib/kwaff/node.rb', line 26

def initialize()
   @empty_lines = 0
end

Instance Attribute Details

#empty_linesObject

Returns the value of attribute empty_lines.



30
31
32
# File 'lib/kwaff/node.rb', line 30

def empty_lines
  @empty_lines
end

Instance Method Details

#accept(translator, level = 0) ⇒ Object

abstract method



17
18
19
# File 'lib/kwaff/node.rb', line 17

def accept(translator, level=0)
   raise NotImplementedError.new("#{self.class.name}#accept() is not implemented.")
end

#to_rexml(toppings = {}) ⇒ Object



20
21
22
23
# File 'lib/kwaff/rexml.rb', line 20

def to_rexml(toppings={})
   translator = Kwaff::RexmlTranslator.new(toppings)
   return translator ? translator.translate(self) : nil
end

#to_xml(toppings = {}) ⇒ Object



21
22
23
24
# File 'lib/kwaff/node.rb', line 21

def to_xml(toppings={})
   translator = XmlTranslator.new(toppings)
   return translator ? translator.translate(self) : nil
end