class OoxmlParser::DocxDrawingPosition

Docx Drawing Position

Attributes

align[RW]
offset[RW]
relative_from[RW]

Public Instance Methods

parse(node) click to toggle source

Parse DocxDrawingPosition object @param node [Nokogiri::XML:Element] node to parse @return [DocxDrawingPosition] result of parsing

# File lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/docx_drawing_position.rb, line 11
def parse(node)
  node.attributes.each do |key, value|
    case key
    when 'relativeFrom'
      @relative_from = value_to_symbol(value)
    end
  end

  node.xpath('*').each do |node_child|
    case node_child.name
    when 'posOffset', 'pctPosHOffset', 'pctPosVOffset'
      @offset = OoxmlSize.new(node_child.text.to_f, :emu)
    when 'align'
      @align = node_child.text.to_sym
    end
  end
  self
end