module OM::XML::Document::ClassMethods

Class Methods – These methods will be available on classes that include this Module

Attributes

template_registry[RW]
terminology[RW]
terminology_builder[RW]

Public Instance Methods

define_template(name, &block) click to toggle source

Define a new node template with the OM::XML::TemplateRegistry.

  • name is a Symbol indicating the name of the new template.

  • The block does the work of creating the new node, and will receive a Nokogiri::XML::Builder and any other args passed to one of the node instantiation methods.

# File lib/om/xml/document.rb, line 73
def define_template name, &block
  self.template_registry.define name, &block
end
extend_terminology(&block) click to toggle source

Update the OM::XML::Terminology with additional terms

# File lib/om/xml/document.rb, line 58
def extend_terminology &block
  self.terminology_builder.extend_terminology(&block)
  rebuild_terminology!
end
ox_namespaces() click to toggle source

Returns any namespaces defined by the Class' Terminology

# File lib/om/xml/document.rb, line 78
def ox_namespaces
  self.terminology.namespaces
end
rebuild_terminology!() click to toggle source
# File lib/om/xml/document.rb, line 44
def rebuild_terminology!
  @terminology = @terminology_builder.build
end
set_terminology(&block) click to toggle source

Sets the OM::XML::Terminology for the Document If there already is a termnology for this class, it will be replaced. @see extend_termniology If you want to add terms to an existing terminology Expects +&block+ that will be passed into OM::XML::Terminology::Builder.new

# File lib/om/xml/document.rb, line 52
def set_terminology &block
  @terminology_builder = OM::XML::Terminology::Builder.new(&block)
  rebuild_terminology!
end
use_terminology(klass) click to toggle source

(Explicitly) inherit terminology from upstream classes

# File lib/om/xml/document.rb, line 64
def use_terminology klass
  self.terminology_builder = klass.terminology_builder.dup
  rebuild_terminology!
end