Class: Goldendocx::Components::Image

Inherits:
Object
  • Object
show all
Includes:
Element
Defined in:
lib/goldendocx/components/image.rb

Instance Attribute Summary collapse

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(type: :shape, **attributes) ⇒ Image

Returns a new instance of Image.



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/goldendocx/components/image.rb', line 18

def initialize(type: :shape, **attributes)
  @type = type
  @container = build_run

  case type
  when :picture
    inline_drawing = @container.build_drawing.build_inline
    inline_drawing.build_non_visual_property
    inline_drawing.build_extents
    inline_drawing.build_graphic.build_data.build_picture
  else
    @container.build_shape
  end

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

Instance Attribute Details

#containerObject (readonly)

Returns the value of attribute container.



16
17
18
# File 'lib/goldendocx/components/image.rb', line 16

def container
  @container
end

#heightObject

Returns the value of attribute height.



16
17
18
# File 'lib/goldendocx/components/image.rb', line 16

def height
  @height
end

#relationship_idObject

Returns the value of attribute relationship_id.



16
17
18
# File 'lib/goldendocx/components/image.rb', line 16

def relationship_id
  @relationship_id
end

#typeObject (readonly)

Returns the value of attribute type.



16
17
18
# File 'lib/goldendocx/components/image.rb', line 16

def type
  @type
end

#widthObject

Returns the value of attribute width.



16
17
18
# File 'lib/goldendocx/components/image.rb', line 16

def width
  @width
end