Class: Powerpoint::Slide::Custom

Inherits:
Object
  • Object
show all
Includes:
Util
Defined in:
lib/powerpoint/slide/custom.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Util

#copy_media, #merge_variables, #pixle_to_pt, #read_template, #render_view, #require_arguments

Constructor Details

#initialize(options = {}) ⇒ Custom

Returns a new instance of Custom.



13
14
15
16
17
18
# File 'lib/powerpoint/slide/custom.rb', line 13

def initialize(options={})
  require_arguments [:title, :properties], options
  options.each {|k, v| instance_variable_set("@#{k}", v)}
  @coords = default_coords unless @coords.present?
  properties
end

Instance Attribute Details

#coordsObject (readonly)

Returns the value of attribute coords.



11
12
13
# File 'lib/powerpoint/slide/custom.rb', line 11

def coords
  @coords
end

#propertiesObject (readonly)

Returns the value of attribute properties.



11
12
13
# File 'lib/powerpoint/slide/custom.rb', line 11

def properties
  @properties
end

#subtitleObject (readonly)

Returns the value of attribute subtitle.



11
12
13
# File 'lib/powerpoint/slide/custom.rb', line 11

def subtitle
  @subtitle
end

#titleObject (readonly)

Returns the value of attribute title.



11
12
13
# File 'lib/powerpoint/slide/custom.rb', line 11

def title
  @title
end

Instance Method Details

#file_typeObject



30
31
32
# File 'lib/powerpoint/slide/custom.rb', line 30

def file_type
  File.extname(image_name).gsub('.', '')
end

#save(extract_path, index) ⇒ Object



20
21
22
23
24
25
26
27
28
# File 'lib/powerpoint/slide/custom.rb', line 20

def save(extract_path, index)
  properties.each do |property|
    if property[:type] == 'image'
      copy_media(extract_path, property[:file_path]) 
    end
  end
  save_rel_xml(extract_path, index)
  save_slide_xml(extract_path, index)
end