Method: RubyXL::OOXMLObjectInstanceMethods#before_write_xml

Defined in:
lib/rubyXL/objects/ooxml_object.rb

#before_write_xmlObject

Subclass provided filter to perform last-minute operations (cleanup, count, etc.) immediately prior to write, along with option to terminate the actual write if false is returned (for example, to avoid writing the collection’s root node if the collection is empty).



344
345
346
347
348
349
350
351
# File 'lib/rubyXL/objects/ooxml_object.rb', line 344

def before_write_xml
  #TODO# This will go away once containers are fully implemented.
  child_nodes = obtain_class_variable(:@@ooxml_child_nodes)
  child_nodes.each_pair { |child_node_name, child_node_params|
    self.count = self.send(child_node_params[:accessor]).size if child_node_params[:is_array] == :with_count
  }
  true
end