Sha256: 34450bb4d03f1e0daf2d28ec8ec45c3cd62e943ad88f8eff36e1fb36b521655c

Contents?: true

Size: 783 Bytes

Versions: 4

Compression:

Stored size: 783 Bytes

Contents

module OoxmlParser
  # Docx Drawing Position
  class DocxDrawingPosition < OOXMLDocumentObject
    attr_accessor :relative_from, :offset, :align

    # Parse DocxDrawingPosition object
    # @param node [Nokogiri::XML:Element] node to parse
    # @return [DocxDrawingPosition] result of parsing
    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
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ooxml_parser-0.4.1 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/docx_drawing_position.rb
ooxml_parser-0.4.0 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/docx_drawing_position.rb
ooxml_parser-0.3.0 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/docx_drawing_position.rb
ooxml_parser-0.2.0 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/docx_drawing_position.rb