Module: OpenXml::Docx::HasProperties

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object


5
6
7
# File 'lib/openxml/docx/has_properties.rb', line 5

def self.included(base)
  base.extend ClassMethods
end

Instance Method Details

#property_xml(xml) ⇒ Object


60
61
62
63
64
65
66
67
# 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) ⇒ Object


53
54
55
56
57
58
# 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