Class: Caracal::Renderers::XmlRenderer
- Inherits:
-
Object
- Object
- Caracal::Renderers::XmlRenderer
- Defined in:
- lib/caracal/renderers/xml_renderer.rb
Direct Known Subclasses
AppRenderer, ContentTypesRenderer, CoreRenderer, DocumentRenderer, FontsRenderer, FooterRenderer, NumberingRenderer, PackageRelationshipsRenderer, RelationshipsRenderer, SettingsRenderer, StylesRenderer
Instance Attribute Summary collapse
-
#document ⇒ Object
readonly
————————————————————- Configuration ————————————————————-.
Class Method Summary collapse
-
.render(doc) ⇒ Object
This method produces xml output for the given document according to the rules of this renderer object.
Instance Method Summary collapse
-
#initialize(doc) ⇒ XmlRenderer
constructor
This method instantiates a new verison of this renderer.
-
#to_xml ⇒ Object
This method converts data in the specified document to XML.
Constructor Details
#initialize(doc) ⇒ XmlRenderer
This method instantiates a new verison of this renderer.
34 35 36 37 38 39 40 |
# File 'lib/caracal/renderers/xml_renderer.rb', line 34 def initialize(doc) unless doc.is_a?(Caracal::Document) raise NoDocumentError, 'renderers must receive a reference to a valid Caracal document object.' end @document = doc end |
Instance Attribute Details
#document ⇒ Object (readonly)
Configuration
12 13 14 |
# File 'lib/caracal/renderers/xml_renderer.rb', line 12 def document @document end |
Class Method Details
.render(doc) ⇒ Object
This method produces xml output for the given document according to the rules of this renderer object.
22 23 24 25 |
# File 'lib/caracal/renderers/xml_renderer.rb', line 22 def self.render(doc) renderer = new(doc) renderer.to_xml end |
Instance Method Details
#to_xml ⇒ Object
This method converts data in the specified document to XML. A concrete implementation must be provided by the subclass.
45 46 47 |
# File 'lib/caracal/renderers/xml_renderer.rb', line 45 def to_xml raise NotImplementedError, 'renderers must implement the method :to_xml.' end |