Class: OoxmlParser::OOXMLShift
- Inherits:
-
Object
- Object
- OoxmlParser::OOXMLShift
- Defined in:
- lib/ooxml_parser/common_parser/common_data/alternate_content/shape/shape_properties/ooxml_shift.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
Instance Method Summary collapse
-
#initialize(x = nil, y = nil) ⇒ OOXMLShift
constructor
A new instance of OOXMLShift.
Constructor Details
#initialize(x = nil, y = nil) ⇒ OOXMLShift
Returns a new instance of OOXMLShift.
5 6 7 8 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/shape/shape_properties/ooxml_shift.rb', line 5 def initialize(x = nil, y = nil) @x = x @y = y end |
Instance Attribute Details
#x ⇒ Object
Returns the value of attribute x.
3 4 5 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/shape/shape_properties/ooxml_shift.rb', line 3 def x @x end |
#y ⇒ Object
Returns the value of attribute y.
3 4 5 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/shape/shape_properties/ooxml_shift.rb', line 3 def y @y end |
Class Method Details
.parse(shift_node, x_name = 'x', y_name = 'y', divider = 360_000) ⇒ Object
10 11 12 13 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/shape/shape_properties/ooxml_shift.rb', line 10 def self.parse(shift_node, x_name = 'x', y_name = 'y', divider = 360_000) return if shift_node.nil? || shift_node.attribute(x_name).nil? || shift_node.attribute(y_name).nil? OOXMLShift.new((shift_node.attribute(x_name).value.to_f / divider.to_f).round(2), (shift_node.attribute(y_name).value.to_f / divider.to_f).round(2)) end |