module OpenXml::Docx::HasProperties

Public Class Methods

included(base) click to toggle source
# File lib/openxml/docx/has_properties.rb, line 5
def self.included(base)
  base.extend ClassMethods
end

Public Instance Methods

property_xml(xml) click to toggle source
# File lib/openxml/docx/has_properties.rb, line 60
def property_xml(xml)
  props = properties.keys.map(&method(:send)).compact
  return if props.none?(&:render?)

  xml[namespace].public_send(properties_tag) {
    props.each { |prop| prop.to_xml(xml) }
  }
end
to_xml(xml) { |xml| ... } click to toggle source
Calls superclass method
# File lib/openxml/docx/has_properties.rb, line 53
def to_xml(xml)
  super(xml) do
    property_xml(xml)
    yield xml if block_given?
  end
end

Private Instance Methods

default_properties_tag() click to toggle source
# File lib/openxml/docx/has_properties.rb, line 79
def default_properties_tag
  :"#{tag}Pr"
end
properties() click to toggle source
# File lib/openxml/docx/has_properties.rb, line 71
def properties
  self.class.properties
end
properties_tag() click to toggle source
# File lib/openxml/docx/has_properties.rb, line 75
def properties_tag
  self.class.properties_tag || default_properties_tag
end