class DocxGenerator::Word::Spacing

Represent the ‘w:spacing` element from Office Open XML specification. This class should not be used directly by the users of the library.

Public Class Methods

new(arguments = {}) click to toggle source

Create a new ‘w:spacing` element. @param arguments [Hash] The different options for the spacing. They can be found in the specification.

Calls superclass method DocxGenerator::Element::new
# File lib/docx_generator/word/formatting.rb, line 64
def initialize(arguments = {})
  final_arguments = {}
  arguments.each do |name, value|
    if name.to_s == "after" || name.to_s == "before"
      final_arguments["w:" + name.to_s] = (value * 20).round
    else
      final_arguments["w:" + name.to_s] = (value * 20 * 12).round
      final_arguments["w:lineRule"] = "auto"
    end
  end
  super("w:spacing", final_arguments)
end