Class: OoxmlParser::OOXMLShift

Inherits:
Object
  • Object
show all
Defined in:
lib/ooxml_parser/common_parser/common_data/alternate_content/shape/shape_properties/ooxml_shift.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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

#xObject

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

#yObject

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