class OoxmlParser::OOXMLCoordinates

Docx Coordinates

Attributes

x[RW]
y[RW]

Public Class Methods

new(x_value, y_value) click to toggle source
# File lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/ooxml_coordinates.rb, line 8
def initialize(x_value, y_value)
  @x = if x_value.is_a?(OoxmlSize)
         x_value
       else
         OoxmlSize.new(x_value)
       end
  @y = if y_value.is_a?(OoxmlSize)
         y_value
       else
         OoxmlSize.new(y_value)
       end
end
parse(position_node, x_attr: 'x', y_attr: 'y', unit: :dxa) click to toggle source

Parse OOXMLCoordinates object @param position_node [Nokogiri::XML:Element] node to parse @param x_attr [String] name of x attribute @param y_attr [String] name of y attribute @param unit [Symbol] unit in which data is stored @return [OOXMLCoordinates] result of parsing

# File lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/ooxml_coordinates.rb, line 39
def self.parse(position_node, x_attr: 'x', y_attr: 'y', unit: :dxa)
  return if position_node.attribute(x_attr).nil? || position_node.attribute(y_attr).nil?

  OOXMLCoordinates.new(OoxmlSize.new(position_node.attribute(x_attr).value.to_f, unit),
                       OoxmlSize.new(position_node.attribute(y_attr).value.to_f, unit))
end

Public Instance Methods

==(other) click to toggle source

Compare two OOXMLCoordinates objects @param other [OOXMLCoordinates] other object @return [True, False] result of comparasion

# File lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/ooxml_coordinates.rb, line 29
def ==(other)
  x == other.x && y == other.y
end
to_s() click to toggle source

@return [String] result of convert of object to string

# File lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/ooxml_coordinates.rb, line 22
def to_s
  "(#{@x}; #{@y})"
end