Class: DocxGenerator::Word::Underline

Inherits:
Element
  • Object
show all
Defined in:
lib/docx_generator/word/formatting.rb

Overview

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

Instance Method Summary collapse

Methods inherited from Element

#add, #generate

Constructor Details

#initialize(arguments = { "w:val" => "single" }) ⇒ Underline

Create a new ‘w:u` element.

Parameters:

  • arguments (Hash) (defaults to: { "w:val" => "single" })

    Arguments for the ‘w:u` element. See the full list in the specification. You can use `style` instead of `w:val` if you want. The list of all underline patterns can be found in the specification.



30
31
32
33
34
35
36
37
38
39
# File 'lib/docx_generator/word/formatting.rb', line 30

def initialize(arguments = { "w:val" => "single" })
  final_arguments = {}
  arguments.each do |option, value|
    case option
      when :style then final_arguments["w:val"] = value
      else final_arguments[option] = value
    end
  end
  super("w:u", final_arguments)
end