Class: Goldendocx::Images::Properties::ShapeProperty

Inherits:
Object
  • Object
show all
Includes:
Element
Defined in:
lib/goldendocx/images/properties/shape_property.rb

Constant Summary collapse

DEFAULT_SHAPE_WIDTH =

1 : 0.618

Goldendocx::Units::EMU_PER_CENTIMETER * 15
DEFAULT_SHAPE_HEIGHT =
Goldendocx::Units::EMU_PER_CENTIMETER * 9.27

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Element

#build_element, #initialize, #namespace, #tag, #tag_name, #to_element, #to_xml

Methods included from HasChildren

#children, #read_child, #read_children

Methods included from HasAttributes

#assign_attributes, #attributes, #read_attributes

Instance Attribute Details

#heightObject

Returns the value of attribute height.



13
14
15
# File 'lib/goldendocx/images/properties/shape_property.rb', line 13

def height
  @height
end

#widthObject

Returns the value of attribute width.



13
14
15
# File 'lib/goldendocx/images/properties/shape_property.rb', line 13

def width
  @width
end

Instance Method Details

#formatted_styleObject



22
23
24
25
26
# File 'lib/goldendocx/images/properties/shape_property.rb', line 22

def formatted_style
  height = ((self.height || DEFAULT_SHAPE_HEIGHT) / Goldendocx::Units::EMU_PER_CENTIMETER).round(2)
  width = ((self.width || DEFAULT_SHAPE_WIDTH) / Goldendocx::Units::EMU_PER_CENTIMETER).round(2)
  "height:#{height}cm;width:#{width}cm"
end