Class: Goldendocx::Images::Picture

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

Instance Method Summary collapse

Methods included from Element

#build_element, #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

Constructor Details

#initialize(**attributes) ⇒ Picture

Returns a new instance of Picture.



16
17
18
19
20
# File 'lib/goldendocx/images/picture.rb', line 16

def initialize(**attributes)
  attributes.each do |name, value|
    send("#{name}=", value) if respond_to?("#{name}=")
  end
end

Instance Method Details

#height=(height) ⇒ Object



26
27
28
# File 'lib/goldendocx/images/picture.rb', line 26

def height=(height)
  picture_shape.transform.extents.height = height if height
end

#relationship_id=(relationship_id) ⇒ Object



30
31
32
33
34
35
36
37
38
# File 'lib/goldendocx/images/picture.rb', line 30

def relationship_id=(relationship_id)
  return unless relationship_id

  non_visual_picture.non_visual_drawing.assign_attributes(
    relationship_id:,
    name: "#{relationship_id}.png"
  )
  picture_fill.blip.relationship_id = relationship_id
end

#width=(width) ⇒ Object



22
23
24
# File 'lib/goldendocx/images/picture.rb', line 22

def width=(width)
  picture_shape.transform.extents.width = width if width
end