module Sablon::DOM
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.
Public Class Methods
register_dom_handler(pattern, klass)
click to toggle source
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.
# 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)
click to toggle source
# 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
Private Class Methods
handlers()
click to toggle source
# File lib/sablon/document_object_model/model.rb, line 31 def handlers @handlers ||= {} end