Class: Kwaff::Translator
- Inherits:
-
Object
- Object
- Kwaff::Translator
- Defined in:
- lib/kwaff/translator.rb
Overview
abstract class for XmlTranslator and KwaffTranslator
Direct Known Subclasses
Instance Attribute Summary collapse
-
#toppings ⇒ Object
readonly
Returns the value of attribute toppings.
Instance Method Summary collapse
-
#initialize(toppings = {}) ⇒ Translator
constructor
A new instance of Translator.
-
#translate(node, level = 0) ⇒ Object
concrete method (don’t override!).
-
#translate_comment(comment, level = 0) ⇒ Object
abstract method.
-
#translate_document(document, level = 0) ⇒ Object
abstract method.
-
#translate_element(document, level = 0) ⇒ Object
abstract method.
-
#translate_text(text, level = 0) ⇒ Object
abstract method.
Constructor Details
#initialize(toppings = {}) ⇒ Translator
Returns a new instance of Translator.
21 22 23 |
# File 'lib/kwaff/translator.rb', line 21 def initialize(toppings={}) @toppings = toppings end |
Instance Attribute Details
#toppings ⇒ Object (readonly)
Returns the value of attribute toppings.
24 25 26 |
# File 'lib/kwaff/translator.rb', line 24 def toppings @toppings end |
Instance Method Details
#translate(node, level = 0) ⇒ Object
concrete method (don’t override!)
28 29 30 |
# File 'lib/kwaff/translator.rb', line 28 def translate(node, level=0) ## don't override! return node.accept(self, level) end |
#translate_comment(comment, level = 0) ⇒ Object
abstract method
43 44 45 |
# File 'lib/kwaff/translator.rb', line 43 def translate_comment(comment, level=0) raise NotImplementedError.new("#{self.class.name}#translate_comment() is not implemented.") end |
#translate_document(document, level = 0) ⇒ Object
abstract method
33 34 35 |
# File 'lib/kwaff/translator.rb', line 33 def translate_document(document, level=0) raise NotImplementedError.new("#{self.class.name}#translate_document() is not implemented.") end |
#translate_element(document, level = 0) ⇒ Object
abstract method
38 39 40 |
# File 'lib/kwaff/translator.rb', line 38 def translate_element(document, level=0) raise NotImplementedError.new("#{self.class.name}#translate_element() is not implemented.") end |
#translate_text(text, level = 0) ⇒ Object
abstract method
48 49 50 |
# File 'lib/kwaff/translator.rb', line 48 def translate_text(text, level=0) raise NotImplementedError.new("#{self.class.name}#translate_text() is not implemented.") end |