Class: Docxer::Word::Medias
- Inherits:
-
Object
- Object
- Docxer::Word::Medias
- Defined in:
- lib/docxer/word/medias.rb,
lib/docxer/word/medias/media.rb
Defined Under Namespace
Classes: Media
Instance Attribute Summary collapse
-
#counter ⇒ Object
Returns the value of attribute counter.
-
#medias ⇒ Object
Returns the value of attribute medias.
Instance Method Summary collapse
- #add(media) ⇒ Object
-
#initialize(options = {}) ⇒ Medias
constructor
A new instance of Medias.
- #render(zip) ⇒ Object
- #sequence ⇒ Object
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(={}) @medias = [] @counter = 0 end |
Instance Attribute Details
#counter ⇒ Object
Returns the value of attribute counter.
7 8 9 |
# File 'lib/docxer/word/medias.rb', line 7 def counter @counter end |
#medias ⇒ Object
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 |
#sequence ⇒ Object
18 19 20 |
# File 'lib/docxer/word/medias.rb', line 18 def sequence @counter += 1 end |