Module: Sablon::DOM
- Defined in:
- lib/sablon/document_object_model/model.rb,
lib/sablon/document_object_model/numbering.rb,
lib/sablon/document_object_model/file_handler.rb,
lib/sablon/document_object_model/content_types.rb,
lib/sablon/document_object_model/relationships.rb
Overview
Stores classes used to build and interact with the template by treating it as a full document model instead of disparate components that are packaged together.
Defined Under Namespace
Classes: ContentTypes, FileHandler, Model, Numbering, Relationships
Class Method Summary collapse
-
.register_dom_handler(pattern, klass) ⇒ Object
Allows new handlers to be registered for different components of the MS Word document.
- .wrap_with_handler(entry_name, content) ⇒ Object
Class Method Details
.register_dom_handler(pattern, klass) ⇒ Object
Allows new handlers to be registered for different components of the MS Word document. The pattern passed in is used to determine if a file in the entry set should be handled by the class.
15 16 17 18 |
# File 'lib/sablon/document_object_model/model.rb', line 15 def register_dom_handler(pattern, klass) handlers[pattern] = klass klass.extend_model(Sablon::DOM::Model) end |
.wrap_with_handler(entry_name, content) ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'lib/sablon/document_object_model/model.rb', line 20 def wrap_with_handler(entry_name, content) key = handlers.keys.detect { |pat| entry_name =~ pat } if key handlers[key].new(content) else Sablon::DOM::FileHandler.new(content) end end |