Class: Docxer::Word::Medias

Inherits:
Object
  • Object
show all
Defined in:
lib/docxer/word/medias.rb,
lib/docxer/word/medias/media.rb

Defined Under Namespace

Classes: Media

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Medias

Returns a new instance of Medias.



8
9
10
11
# File 'lib/docxer/word/medias.rb', line 8

def initialize(options={})
  @medias = []
  @counter = 0
end

Instance Attribute Details

#counterObject

Returns the value of attribute counter.



7
8
9
# File 'lib/docxer/word/medias.rb', line 7

def counter
  @counter
end

#mediasObject

Returns the value of attribute medias.



7
8
9
# File 'lib/docxer/word/medias.rb', line 7

def medias
  @medias
end

Instance Method Details

#add(media) ⇒ Object



13
14
15
16
# File 'lib/docxer/word/medias.rb', line 13

def add(media)
  @medias << media
  media
end

#render(zip) ⇒ Object



22
23
24
25
26
27
# File 'lib/docxer/word/medias.rb', line 22

def render(zip)
  @medias.each do |media|
    zip.put_next_entry("word/#{media.target}")
    zip.write(media.file.read)
  end
end

#sequenceObject



18
19
20
# File 'lib/docxer/word/medias.rb', line 18

def sequence
  @counter += 1
end