Module: OM::XML::Document::ClassMethods
- Defined in:
- lib/om/xml/document.rb
Overview
Class Methods – These methods will be available on classes that include this Module
Instance Attribute Summary collapse
- 
  
    
      #template_registry  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    Returns the value of attribute template_registry. 
- 
  
    
      #terminology  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    Returns the value of attribute terminology. 
- 
  
    
      #terminology_builder  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    Returns the value of attribute terminology_builder. 
Instance Method Summary collapse
- 
  
    
      #define_template(name, &block)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Define a new node template with the OM::XML::TemplateRegistry. 
- 
  
    
      #extend_terminology(&block)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Update the OM::XML::Terminology with additional terms. 
- 
  
    
      #ox_namespaces  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Returns any namespaces defined by the Class’ Terminology. 
- #rebuild_terminology! ⇒ Object
- 
  
    
      #set_terminology(&block)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Sets the OM::XML::Terminology for the Document If there already is a termnology for this class, it will be replaced. 
- 
  
    
      #use_terminology(klass)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    (Explicitly) inherit terminology from upstream classes. 
Instance Attribute Details
#template_registry ⇒ Object
Returns the value of attribute template_registry.
| 15 16 17 | # File 'lib/om/xml/document.rb', line 15 def template_registry @template_registry end | 
#terminology ⇒ Object
Returns the value of attribute terminology.
| 15 16 17 | # File 'lib/om/xml/document.rb', line 15 def terminology @terminology end | 
#terminology_builder ⇒ Object
Returns the value of attribute terminology_builder.
| 15 16 17 | # File 'lib/om/xml/document.rb', line 15 def terminology_builder @terminology_builder end | 
Instance Method Details
#define_template(name, &block) ⇒ Object
Define a new node template with the OM::XML::TemplateRegistry.
- 
nameis a Symbol indicating the name of the new template.
- 
The blockdoes 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.
| 73 74 75 | # File 'lib/om/xml/document.rb', line 73 def define_template name, &block self.template_registry.define name, &block end | 
#extend_terminology(&block) ⇒ Object
Update the OM::XML::Terminology with additional terms
| 58 59 60 61 | # File 'lib/om/xml/document.rb', line 58 def extend_terminology &block self.terminology_builder.extend_terminology(&block) rebuild_terminology! end | 
#ox_namespaces ⇒ Object
Returns any namespaces defined by the Class’ Terminology
| 78 79 80 | # File 'lib/om/xml/document.rb', line 78 def ox_namespaces self.terminology.namespaces end | 
#rebuild_terminology! ⇒ Object
| 44 45 46 | # File 'lib/om/xml/document.rb', line 44 def rebuild_terminology! @terminology = @terminology_builder.build end | 
#set_terminology(&block) ⇒ Object
Sets the OM::XML::Terminology for the Document If there already is a termnology for this class, it will be replaced. Expects &block that will be passed into OM::XML::Terminology::Builder.new
| 52 53 54 55 | # 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) ⇒ Object
(Explicitly) inherit terminology from upstream classes
| 64 65 66 67 | # File 'lib/om/xml/document.rb', line 64 def use_terminology klass self.terminology_builder = klass.terminology_builder.dup rebuild_terminology! end |