Class: OoxmlParser::OOXMLCoordinates
- Inherits:
-
Object
- Object
- OoxmlParser::OOXMLCoordinates
- Defined in:
- lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/ooxml_coordinates.rb
Instance Attribute Summary collapse
-
#x ⇒ Object
Returns the value of attribute x.
-
#y ⇒ Object
Returns the value of attribute y.
Class Method Summary collapse
-
.parse(position_node, x_attr: 'x', y_attr: 'y', delimiter: OoxmlParser.configuration.units_delimiter) ⇒ OOXMLCoordinates
Parse OOXMLCoordinates object.
Instance Method Summary collapse
-
#==(other) ⇒ True, False
Compare two OOXMLCoordinates objects.
-
#initialize(x, y) ⇒ OOXMLCoordinates
constructor
A new instance of OOXMLCoordinates.
- #to_s ⇒ Object
Constructor Details
#initialize(x, y) ⇒ OOXMLCoordinates
Returns a new instance of OOXMLCoordinates.
6 7 8 9 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/ooxml_coordinates.rb', line 6 def initialize(x, y) @x = x @y = y end |
Instance Attribute Details
#x ⇒ Object
Returns the value of attribute x.
4 5 6 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/ooxml_coordinates.rb', line 4 def x @x end |
#y ⇒ Object
Returns the value of attribute y.
4 5 6 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/ooxml_coordinates.rb', line 4 def y @y end |
Class Method Details
.parse(position_node, x_attr: 'x', y_attr: 'y', delimiter: OoxmlParser.configuration.units_delimiter) ⇒ OOXMLCoordinates
Parse OOXMLCoordinates object
28 29 30 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/ooxml_coordinates.rb', line 28 def self.parse(position_node, x_attr: 'x', y_attr: 'y', delimiter: OoxmlParser.configuration.units_delimiter) OOXMLCoordinates.new((position_node.attribute(x_attr).value.to_f / delimiter).round(3), (position_node.attribute(y_attr).value.to_f / delimiter).round(3)) end |
Instance Method Details
#==(other) ⇒ True, False
Compare two OOXMLCoordinates objects
18 19 20 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/ooxml_coordinates.rb', line 18 def ==(other) x == other.x && y == other.y end |
#to_s ⇒ Object
11 12 13 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/ooxml_coordinates.rb', line 11 def to_s '(' + @x.to_s + '; ' + @y.to_s + ')' end |